Archive: need some help


need some help
Could you help me with a script?
i want to have an install file , not autorun .
A titel , and some place to write and a destination folder.
(with a browse buton , cancel and install.)
after he installed all the files i want him to open a file that was just installed .
if the program runs, nothing should happens to the install file , but if the program closes ,
the programm should be removed and again a screen appears ...
(with again a title , some place to write , and a finish button .)

first menu :
http://img123.imageshack.us/img123/6...menuuh2.th.jpg
second menu :
http://img146.imageshack.us/img146/2...menurz8.th.jpg
third menu :
http://img19.imageshack.us/img19/126...menujm1.th.jpg

thanks


I'm confused as what you want. What is wrong with the installer that you already have? Or are those screenshots of another installer?

Stu


well , i used them from a nsis example : library ,
but i can't figure out how i could make him to open a file and afterwards remove it .


Use ExecWait to open an executable and wait for it to close and then Delete to delete the file.

You may also want to use Modern UI (Examples\Modern UI) which has Welcome and Finish pages.

Stu


can u make a installer file that can't be copied?

and uninstalles a file and itself?


You cannot prevent a user copying your installer.
To delete oneself you have to execute (Exec) another program (which you can write in NSIS) that deletes the calling installer and then quits.

Stu


so it can't uninstal itself?


ok , i've got this so far :
now i only need the install file to be deleted , how should i do this ?(and is there a way to edit the layout?)




Name "hello"

OutFile "hello.exe"

InstallDir "$PROGRAMFILES\hi\hello"

Page directory

Page instfiles

Section ""

SetOutPath $INSTDIR

File "C:\hi\files\1.txt"
File "C:\hi\files\2.txt"
File "C:\hi\files\3.txt"
File "C:\hi\files\4.txt"
File "C:\hi\files\5.txt"
File "C:\hi\files\6.txt"
File "C:\hi\files\7.txt"
File "C:\hi\files\8.txt"
File "C:\hi\files\9.exe"

ExecWait '"$INSTDIR\9.exe" _?=$INSTDIR'

Delete $INSTDIR\9.exe

SetAutoClose true

SectionEnd


Name Delete
OutFile delete_hello.exe
SilentInstall silent

Function .onInit
Sleep 1000
ReadRegStr $R0 HKLM "Software\hello" "InstallerLocation"
Delete "$R0\hello.exe"
Abort
FunctionEnd

Section
SectionEnd



File "/oname=$PLUGINSDIR\delete_hello.exe" "delete_hello.exe"
WriteRegStr HKLM "Software\hello" "InstallerLocation" "$EXEDIR"
Exec "$PLUGINSIR\delete_hello.exe"
Quit


First code snippet is code to be built as a separate executable. The second code snippet must go in your installer.

Stu

but than i have the delete_hello
that has to be removed to!

And does it has to be :

Name "hello"

OutFile "hello.exe"

InstallDir "$PROGRAMFILES\hi\hello"

Page directory

Page instfiles

Section ""

SetOutPath $INSTDIR

File "C:\hi\files\1.txt"
File "C:\hi\files\2.txt"
File "C:\hi\files\3.txt"
File "C:\hi\files\4.txt"
File "C:\hi\files\5.txt"
File "C:\hi\files\6.txt"
File "C:\hi\files\7.txt"
File "C:\hi\files\8.txt"
File "C:\hi\files\9.exe"

ExecWait '"$INSTDIR\9.exe" _?=$INSTDIR'

Delete $INSTDIR\9.exe

SetAutoClose true

SectionEnd

File "/oname=$PLUGINSIR\delete_hello.exe" "delete_hello.exe"
WriteRegStr HKLM "Software\hello" "InstallerLocation" "$EXEDIR"
Exec "$PLUGINSIR\delete_hello.exe"
Quit

or

Name "hello"

OutFile "hello.exe"

InstallDir "$PROGRAMFILES\hi\hello"

Page directory

Page instfiles

Section ""

SetOutPath $INSTDIR

File "C:\hi\files\1.txt"
File "C:\hi\files\2.txt"
File "C:\hi\files\3.txt"
File "C:\hi\files\4.txt"
File "C:\hi\files\5.txt"
File "C:\hi\files\6.txt"
File "C:\hi\files\7.txt"
File "C:\hi\files\8.txt"
File "C:\hi\files\9.exe"

ExecWait '"$INSTDIR\9.exe" _?=$INSTDIR'

Delete $INSTDIR\9.exe
File "/oname=$PLUGINSIR\delete_hello.exe" "delete_hello.exe"
WriteRegStr HKLM "Software\hello" "InstallerLocation" "$EXEDIR"
Exec "$PLUGINSIR\delete_hello.exe"
Quit

SetAutoClose true

SectionEnd


ikkeugh wrote
can u make a installer file that can't be copied?
and uninstalles a file and itself?
but than i have the delete_hello
that has to be removed to!
I wonder if all this effort to delete the installer is an attempt to make an installer that can't be copied? If that is what you're doing, I'd say that you are wasting your time -- a user could always make a copy of the installer, save it off on another disk/media (CD-ROM, flash disk) and then run the installer and not care that one copy was deleted, he still has another copy.

If you want to delete the installer for another reason, I suggest this method: have the installer write a short vbscript that will delete the installer and itself. (Vbscripts can delete themselves because the real exe (wscript.exe) is not deleted.) You could run the vbscript from the final callback in the installer (function .onInstSuccess).

Don

You don't need to delete the delete_hello executable because it is in $PLUGINSDIR which will be delete when the installer closes.

Stu


Stu
Did you test your solution? I think the delete of $PLUGINSDIR will not work because delete_hello.exe is running and not deletable.

If the installer waits (or hangs) while the delete of $PLUGINSDIR tries to do its thing it could succeed, but that would mean that delete_hello terminated (and failed to delete hello.exe).

Don


thanks all : that last one did it !!!!


That's true. You should probably put RMDir /r /rebootok $EXEDIR in delete_hello.nsi just to be safe.

Edit: Also, $PLUGINSIR -> $PLUGINSDIR (missing D in my code).

Stu


I used the one of Don , is there any problem with that one?
and is there a way to AUTOSTART the installation file after downloaded?


The one of Don?

No you cannot do that. It would be a serious security vulnerability if programs could do that.

Stu