Archive: Autorun help


Autorun help
is there a code that will let me "autorun" my app after install

thanks


1) Exec open "$INSTDIR\Myapp.exe"
2) ExecWait open "$INSTDIR\MyApp.exe"

The first one will open it. The second one will wait until it is closed to finish install.

-Duane


I use this:
Function .onInstSuccess
MessageBox MB_YESNO|MB_ICONQUESTION "Installation has completed. Launch MyApp now?" IDNO NoLaunch
ExecShell open "$INSTDIR\MyApp.exe"
NoLaunch:
FunctionEnd


  ExecShell open "$INSTDIR\MyApp.exe"
Exec $INSTDIR\MyApp.exe
Both of these lines do exactly the same thing. But the second one is faster because it doesn't check the registry to see what it has to do with the file.

Also, notice how I didn't surround with quotes in the second one. Quotes are only needed if the parameter ($INSTDIR\MyApp.exe) has a space. So
  Exec "$INSTDIR\My App.exe"
would need quotes.

Thankyou
Thankyou very much.


Originally posted by petersa
Also, notice how I didn't surround with quotes in the second one. Quotes are only needed if the parameter ($INSTDIR\MyApp.exe) has a space. So
  Exec "$INSTDIR\My App.exe"
would need quotes.
But, maybe it's better to surround it with quotes, though the .exe not contain space, $INSTDIR can be resolved to string that contain space.

Originally posted by deeva

But, maybe it's better to surround it with quotes, though the .exe not contain space, $INSTDIR can be resolved to string that contain space.
Even if $INSTDIR contains spaces, you don't need to surround it in quotes.

  SetOutPath $INSTDIR
This would never need quotes, regardless of its contents.

  SetOutPath $INSTDIR\Data Files
This wouldn't work.

Note that Exec needs a string that has quotes if it has spaces.
i.e. This would be necessary for reliable launching:

Exec '"$INSTDIR\MyApp.exe"'

-Justin


Originally posted by justin
Note that Exec needs a string that has quotes if it has spaces.
i.e. This would be necessary for reliable launching:

Exec '"$INSTDIR\MyApp.exe"'
Okay, well apart from the Exex command, none of the other commands require quotes, because if they did, then all of these lines, taken from MAKENSIS.NSI, would yield unreliable directory creation/deletion, unreliable uninstaller creation...which they don't. :D

I don't see why Exec breaks this rule, though!

I think I can safely say that on most sytems, $PROGRAMFILES, $INSTDIR, and $SMPROGRAMS will all expand to something containing a space in it. Obviously here, they aren't surrounded by quotes of any kind.
InstallDir $PROGRAMFILES\NSIS
SetOutPath $INSTDIR
SetOutPath $SMPROGRAMS\NSIS
SetOutPath $INSTDIR\Contrib
RMDir /r $INSTDIR\Source\Splash
SetOutPath $INSTDIR\Contrib\Splash
IfFileExists $SMPROGRAMS\NSIS 0 NoShortCuts
CreateDirectory $SMPROGRAMS\NSIS\Contrib
RMDir /r $INSTDIR\Source\Zip2Exe
SetOutPath $INSTDIR\Contrib\zip2exe
SetOutPath $INSTDIR\Contrib\zip2exe\zlib
SetOutPath $INSTDIR\Contrib\InstallOptions
SetOutPath $INSTDIR\Contrib\NSISdl
SetOutPath $INSTDIR\Source
SetOutPath $INSTDIR\Source\zlib
SetOutPath $INSTDIR\Source\bzip2
SetOutPath $INSTDIR\Source\exehead
IfFileExists $SMPROGRAMS\NSIS 0 NoSourceShortCuts
SetOutPath $INSTDIR\Contrib\ExDLL
Delete $INSTDIR\uninst-nsis.exe
WriteUninstaller $INSTDIR\uninst-nsis.exe
Delete $SMPROGRAMS\NSIS\Contrib\*.lnk
Delete $SMPROGRAMS\NSIS\Contrib\*.url
RMDir $SMPROGRAMS\NSIS\Contrib
RMDir /r $INSTDIR\Contrib
Delete $SMPROGRAMS\NSIS\*.lnk
Delete $SMPROGRAMS\NSIS\*.url
RMDir $SMPROGRAMS\NSIS
Delete $DESKTOP\MakeNSIS.lnk
Delete $INSTDIR\makensis*.exe
Delete $INSTDIR\zip2exe.exe
Delete $INSTDIR\installoptions.exe
Delete $INSTDIR\installoptions.dll
Delete $INSTDIR\splash.txt
Delete $INSTDIR\splash.exe
Delete $INSTDIR\makensis.htm
Delete $INSTDIR\functions.htm
Delete $INSTDIR\makensis.rtf
Delete $INSTDIR\uninst-nsis.exe
Delete $INSTDIR\nsisconf.nsi
Delete $INSTDIR\makensis.nsi
Delete $INSTDIR\example1.nsi
Delete $INSTDIR\example2.nsi
Delete $INSTDIR\waplugin.nsi
Delete $INSTDIR\viewhtml.nsi
Delete $INSTDIR\bigtest.nsi
Delete $INSTDIR\primes.nsi
Delete $INSTDIR\rtest.nsi
Delete $INSTDIR\uglytest.nsi
Delete $INSTDIR\spin.nsi
Delete $INSTDIR\wafull.nsi
Delete $INSTDIR\piglatin.nsh
Delete $INSTDIR\caps.nsh
Delete $INSTDIR\upgradedll.nsh
Delete $INSTDIR\WinMessages.nsh
Delete $INSTDIR\main.ico
Delete $INSTDIR\makensis-license.txt
Delete $INSTDIR\license.txt
Delete $INSTDIR\uninst.ico
Delete $INSTDIR\bitmap1.bmp
Delete $INSTDIR\bitmap2.bmp
RMDir /r $INSTDIR\Source
RMDir $INSTDIR
MAKENSIS.NSI is living proof that quotes are not, not, NOT! needed when that particular parameter you type doesn't have a space. Regardless of what it expands to on runtime.

Because if MAKENSIS.NSI didn't compile, none of us would know what NSIS was.

The end. :D