Old 20th June 2007, 18:43   #1
ikkeugh
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
ikkeugh is offline   Reply With Quote
Old 20th June 2007, 21:27   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 21st June 2007, 11:07   #3
ikkeugh
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 .
ikkeugh is offline   Reply With Quote
Old 21st June 2007, 11:35   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 21st June 2007, 14:10   #5
ikkeugh
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?
ikkeugh is offline   Reply With Quote
Old 21st June 2007, 17:21   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 23rd June 2007, 15:00   #7
ikkeugh
Junior Member
 
Join Date: Jun 2007
Posts: 8
so it can't uninstal itself?
ikkeugh is offline   Reply With Quote
Old 23rd June 2007, 17:48   #8
ikkeugh
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
ikkeugh is offline   Reply With Quote
Old 23rd June 2007, 17:59   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
code:
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



code:

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
Afrow UK is offline   Reply With Quote
Old 24th June 2007, 13:57   #10
ikkeugh
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
ikkeugh is offline   Reply With Quote
Old 24th June 2007, 17:02   #11
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Quote:
ikkeugh wrote
can u make a installer file that can't be copied?
and uninstalles a file and itself?
Quote:
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
Attached Files
File Type: nsi deleteme.nsi (1.0 KB, 281 views)
demiller9 is offline   Reply With Quote
Old 24th June 2007, 17:29   #12
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 24th June 2007, 18:55   #13
demiller9
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
demiller9 is offline   Reply With Quote
Old 24th June 2007, 20:17   #14
ikkeugh
Junior Member
 
Join Date: Jun 2007
Posts: 8
thanks all : that last one did it !!!!
ikkeugh is offline   Reply With Quote
Old 24th June 2007, 21:14   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Old 25th June 2007, 20:21   #16
ikkeugh
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?
ikkeugh is offline   Reply With Quote
Old 25th June 2007, 21:55   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
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
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump