|
|
#1 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
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 : ![]() second menu : ![]() third menu : ![]() thanks |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
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 . |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
can u make a installer file that can't be copied?
and uninstalles a file and itself? |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
so it can't uninstal itself?
|
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
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 |
|
|
|
|
|
#9 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
code: code: First code snippet is code to be built as a separate executable. The second code snippet must go in your installer. Stu |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
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 |
|
|
|
|
|
#11 | ||
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
Quote:
Quote:
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 |
||
|
|
|
|
|
#12 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
You don't need to delete the delete_hello executable because it is in $PLUGINSDIR which will be delete when the installer closes.
Stu |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
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 |
|
|
|
|
|
#14 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
thanks all : that last one did it !!!!
|
|
|
|
|
|
#15 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
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 |
|
|
|
|
|
#16 |
|
Junior Member
Join Date: Jun 2007
Posts: 8
|
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? |
|
|
|
|
|
#17 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
The one of Don?
No you cannot do that. It would be a serious security vulnerability if programs could do that. Stu |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|