- NSIS Discussion
- Justin?
Archive: Justin?
petersa
30th April 2001 13:55 UTC
Sorry to post this again, but I've been fiddling for ages to try and get it working, no one here seems to know what to do, and the original thread seems to have been forgotten...I hope I don't get into too much trouble! :(
Hi all,
For some reason, this code doesn't work right. If yes, the program should run and the installer should quit. If no, the installer should stay put and let the user see the details. It quits though, no matter what is chosen!
Am I doing something wrong?
AutoCloseWindow False
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to run it now?" IDNO 2
AutoCloseWindow True
Exec "$INSTDIR\IT.EXE"
rainwater
30th April 2001 16:37 UTC
I believe the compiler options are set at compile time, so the AutoCloseWindow is parsed regardless of the jump statement. If you are using the new version, labels are required instead of numbers for the jumps.
You may want to try putting the statements in a !ifdef and !ifndef instead.
yazno
30th April 2001 18:49 UTC
hi,
what you are trying to do is not possible at the moment.
-
justin .. would it be possible to make it so that you are able to set defines within functions ?
for example:
Function ASK
MessageBox MB_YESNO|MB_ICONQUESTION "Would you like to run it now?" IDNO END
!define close
ExecShell open "$INSTDIR"
END:
FunctionEnd
!ifdef close
autoclosewindow true
!endif
Section "Required"
SetOutPath -
call ask
SectionEnd
or better yet to call the .onInstSuccess and .onInstFailed Callbacks when finished with installing and not when pushing the close button ?
cu yzo
Kaboon
2nd May 2001 21:02 UTC
In case you didn't figured it out yet... :)
Function .onInstSuccess
MessageBox MB_YESNO|MB_ICONQUESTION \
"Setup has completed. Run PROGRAM now?" \
IDNO NoExec
ExecShell open '$INSTDIR\PROGRAM.exe'
NoExec:
FunctionEnd
Past that above the un-install code
yazno
2nd May 2001 21:45 UTC
kaboon,
.onInstSuccess is called _after_ you push the close button!
that is not what petersa wanted.
cu yzo
Kaboon
2nd May 2001 22:21 UTC
I'm sorry wasn't paying 100% attention here. :D
petersa
3rd May 2001 12:33 UTC
Sorry, I haven't explained myself properly.
What I want to happen, is the install to finish its copying, and throw the message box up. Depending on the answer, it should either do or don't close the box.
Since it isn't a feature, can this be put in, please?
As for the labels, I wrote this before labels were invented... :)
Alex
Kaboon
3rd May 2001 18:36 UTC
I still don't get it...
yazno and petersa, I still think that this will work:
AutoCloseWindow true
Function .onInstSuccess
MessageBox MB_YESNO|MB_ICONQUESTION \
"Setup has completed. Run ProgramX now?" \
IDNO NoExec
ExecShell open '$INSTDIR\ProgramX.exe'
NoExec:
FunctionEnd
Koen van de Sande
3rd May 2001 21:06 UTC
But they don't want to close the window to close automatically IIRC.
petersa
4th May 2001 07:05 UTC
Okay,
I want to ask the user if they want to run the program. If they do, I want the installer to close. If they don't, I want the installer to stay open so they can look at what went on.
Alex
yazno
4th May 2001 09:36 UTC
well,
like i said, you won't be able to do that with the normal commands, but it is still possible.
1. make an installer like this:
----- cut ------
Name " "
OutFile closeinstaller.exe
SilentInstall silent
CRCCheck off
Section ""
FindWindowByTitle close 'test Setup: Installing Files'
FindWindowByTitle close 'test Setup: Completed'
Delete /REBOOTOK $TEMP\closeinstaller.exe
SectionEnd
------ cut ------
then make your normal installer like this:
------- cut -----
Name test
OutFile test_setup.exe
InstallDir $PROGRAMFILES\TEST
AutoCloseWindow false
Function WannaRun
MessageBox MB_YESNO 'Run the program now?' IDNO CLOSE
SetOutPath $TEMP
File closeinstaller.exe
Exec $INSTDIR\whatever.exe
Exec $TEMP\closeinstaller.exe
CLOSE:
FunctionEnd
Section ""
SetOutPath -
File whatever.exe
Call WannaRun
SectionEnd
---- cut -----
thats it ..
btw: Justin, please implement a CloseSetup command!!
cu yzo
yazno
8th May 2001 05:20 UTC
hi,
since nsis 1.42 is out and with it 'SetAutoClose', it is possible now!
Function WannaRun
MessageBox MB_YESNO 'Run the program now?' IDNO lbl_end
SetAutoClose true
Exec whatever.exe
lbl_end:
FunctionEnd
thx justin!
cu yzo
petersa
9th May 2001 01:10 UTC
Thanks yzo! Thanks Justin!