Archive: ExecWait don't wait ? Can't lunch 2.exe :(


ExecWait don't wait ? Can't lunch 2.exe :(
Hello,

I am a newbie in NSIS, and I acknowledge that I do not understand my error.
Especially how my script is really simple!!
I will try to explain me with my English of 3 year old child.

It is broken up into 3 files NSI. (Thus 3.exe)

> The first (1.nsi), allows to uninstall an application, write a key of register (to launch the 2nd .exe): Function well!
> The second (2.nsi) start on Windows logon. An installation is carried out (functions well!) and with the end (3.nsi), the achievable last would have started. But it is not the case!

PS: If ever I launch my 3rd file .exe (3.nsi) the functions included in script functions well. I do not include/understand why it cannot be launched by my second script…

I hope to be sufficiently clear…

Here my 3 small script in attached file.
1.nsi
2.nsi
3.nsi

Thank for your help !!!


Where in your script did you create BEW.exe?

In 2.nsi you have this:

Section "Global-package"

SetOutPath "$TEMP"

#Install BE + Récupération data
ExecWait '"$TEMP\BEW.exe" /q /cfg:"last.eac" /t /l:us' $0
DetailPrint "Erreurs $0"
ExecWait '"$TEMP\test.exe"'

SectionEnd

Where does BEW.exe come from? Don't you need to extract it first? :
Section "Global-package"

SetOutPath "$TEMP"
File "Installers\BEW.exe"

#Install BE + Récupération data
ExecWait '"$TEMP\BEW.exe" /q /cfg:"last.eac" /t /l:us' $0
DetailPrint "Erreurs $0"
ExecWait '"$TEMP\test.exe"'

SectionEnd

Or better yet, to avoid filename conflicts and problems due to locked files, I use GetTempFileName like this:
Section "Global-package"

SetOutPath "$TEMP"

Var /GLOBAL _1_BewExe
GetTempFileName $_1_BewExe
File /oname=$_1_BewExe "Installers\BEW.exe"

#Install BE + Récupération data
ExecWait '"$_1_BewExe" /q /cfg:"last.eac" /t /l:us' $0
DetailPrint "Erreurs $0"
ExecWait '"$TEMP\test.exe"'

SectionEnd

Thank for your feedback,

In fact, BEW.exe is an external executable.
2.nsi is launch by 1.nsi -> Theses actions is functional

But 3.nsi (test.exe) don’t start automatically. If I launch manually test.exe, actions are successful.
I don’t understand why my “2.nsi” can’t start this executable (ExecWait '"$TEMP\test.exe"')

Strange, no ? :p


Re: ExecWait don't wait ? Can't lunch 2.exe :(

Originally posted by DraGula0
Hello,

I am a newbie in NSIS, and I acknowledge that I do not understand my error.
Especially how my script is really simple!!
I will try to explain me with my English of 3 year old child.

It is broken up into 3 files NSI. (Thus 3.exe)

> The first (1.nsi), allows to uninstall an application, write a key of register (to launch the 2nd .exe): Function well!
> The second (2.nsi) start on Windows logon. An installation is carried out (functions well!) and with the end (3.nsi), the achievable last would have started. But it is not the case!

PS: If ever I launch my 3rd file .exe (3.nsi) the functions included in script functions well. I do not include/understand why it cannot be launched by my second script…

I hope to be sufficiently clear…

Here my 3 small script in attached file.
1.nsi
2.nsi
3.nsi

Thank for your help !!!
i wrote a this header that would allow build multiple script in one... you can exec any single section by command line. the parameter refer to section name.
this needed "NSISArray" to complie

In fact, BEW.exe is an external executable.
I understand it's external. My point is, are you sure it even exists in $TEMP at runtime. Because $TEMP is a variable, I wouldn't just assume that it is C:\Windows\Temp. $TEMP might be Docs&Settings\Local Data\Temp or something like that.

This is why I feel strongly that if you want to be absolutely sure BEW.exe or test.exe exists at runtime in the expected location, then you should just use the File isntruction to extract them as I did in my example. Or at the very least use FileExists to verify it exists before trying to run.

You could do this for testing:

!include "LogicLib.nsh"

${If} ${FileExists} "$TEMP\test.exe"
MessageBox MB_OK "test.exe found"
${Else}
MessageBox MB_OK "test.exe NOT found"
${EndIf}


If you get the second message, then the file doesn't even exist at that path, which would be why ExecWait fails.

Hi !

AaronLS, I've add your code for testing :

Result : test.exe found

Good ! But test.exe is not executed :weird:


ttworc > I will try your script soon, thank for your help :-)


If you don't have any luck with that, here's one other diagnostic, checking to see if NSIS detected an error. Use ClearErrors just before to ensure flag is cleared, and then check errors right after:

Section "Global-package"

SetOutPath "$TEMP"

#Install BE + Récupération data
ExecWait '"$TEMP\BEW.exe" /q /cfg:"last.eac" /t /l:us' $0
DetailPrint "Erreurs $0"
ClearErrors
ExecWait '"$TEMP\test.exe"'
${If} ${Errors}
DetailPrint "Error executing test.exe"
${EndIf}

SectionEnd

AaronLS,

Yes, I'm not lucky...

I have add your modification in "2.nsi".
There is no message on screen, and no executing of test.exe.

And... If I launch test.exe manually, result is good.


I'm desperate !


No id ? :-(


If test.exe is silent, how can you be sure it really isn't executed? It looks like test.exe is trying to copy over some additional files into what BEW.exe creates. If ExecWait doesn't really wait for BEW.exe because it's a special installer, the directory where test.exe should write its files doesn't exist and so it fails.

BTW, you can use $SYSDIR instead of C:\Windows\system32 and C:\WinNT\system32.