|
|
#1 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Auto-run the installed app
Hello all,
I'm having a slight problem with the end of my installer. I have been asked to make the program we are installing auto run once the installation has finished. At the minute I have a dummy section which ends thus: code: However my program is shutting itself down straight away. I have a feeling this is to do with the way I am running the program from the installs as if I navigate to the install path and run it from there it runs fine. Any help would be greatly appreciated |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
SetOutPath will set the working directory, so you should probably set it to the LTP folder. Also, you should specify the full path to the exe in ExecShell (Just plain Exec is fine for .exe files, no need to use ExecShell)
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
The output path has been set at the beginning of the script.
however I shall quickly try this and see. *Edit* Nope no luck using code: |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
After some investigation it appears as though my exe is being moved away from its data which causes the file to auto exit.
So my next question is does either exec or execshell move the application |
|
|
|
|
|
#5 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
of course it does not move the file
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Well the executable is sat right next to my data folder, the executable runs when I run it manually. I've debugged my application and when run from the installer it cannot find a required file in the data folder. So it seems the logical explanations are that either the application has been moved, the wrong application is being run or the data has moved.
|
|
|
|
|
|
#7 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
wrong working / current directory?
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Everything extracts to the correct dir which is $OUTDIR\LTP
and the documentation states that exec and execshell both use the current $OUTDIR as their working directory. so i don't think so. I've gotten around the problem for the moment by using: ExecShell open LTP\Short which is a shortcut to the file and that runs it correctly. however I would like to get to the real issue and not have to use the shortcut |
|
|
|
|
|
#9 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
check with process explorer to see the working directory. And process monitor or filemon to see which directory your application is looking in
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Process Monitor reports that it is looking in the same folder as the installer is located in.
However the application should only look in the folder it resides in. Process Explorer is reporting that it has been executed from LTP\ so Im still at a bit of a dead end |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Just to keep the thread updated so please excuse the double post.
On a whim I added the following lines code: the EXEDIR is there purely for debug purposes btw. And it now works... yay. my next question is can I use syntax like code: if so I think that will solve my problem well enough |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
You say it's been executed from LTP\ And you say you don't want that so why are you still talking about SetOutPath $OUTDIR\LTP??
If you install the .exe to $instdir\myapp.exe, all you need is SetOutPath $instdir IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
I didn't say I didn't want it run from the \LTP folder.
I set the outdir to $exedir\LTP as an experiment to see if it for some unknown reason effected the directory my program was using as its root. And I set the root to $EXEDIR as other files are used in that root and then the application itself and its data is extracted to .\LTP I'm just more curious as to why the SetOutPath function affects the root of my application. |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,449
|
because setoutpath changes the current aka working directory, a child process will inherit this working folder unless you specify a new working folder when calling CreateProcess (so, the nsis way to specify it is to use setoutpath before calling Exec)
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Mar 2009
Posts: 9
|
Ah that makes sense now then.
Thank you for your help |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|