Archive: Justin?


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"

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.


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


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

kaboon,

.onInstSuccess is called _after_ you push the close button!

that is not what petersa wanted.

cu yzo


I'm sorry wasn't paying 100% attention here. :D


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


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



But they don't want to close the window to close automatically IIRC.


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


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


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


Thanks yzo! Thanks Justin!