Archive: having a messagebox display error level


having a messagebox display error level
Im not the most savvy programmer out there so please help me out.

Im trying to install a file and then run it using execwait. sometimes it works, sometimes it doesnt. im trying to figure out why and put the right measures in place to ensure that it runs. once the the file update.exe runs, it will change its name to "success.exe" so if its not run, it will still be there as "update.exe". here's the code...

ExecWait "$TEMP\update.exe"

IfFileExists "$TEMP\update.exe" yes
yes:
ExecWait "$TEMP\update.exe"

IfErrors error
error:
MessageBox MB_OK ErrorLevels

Id like to figure out two things here:

1. how do i display the error level in the messagebox?
2. if there is an error i want to loop back to the iffileexists...should i make that a function?

your help is greatly appreciated.


To loop back add a label and use Goto.

To display the error level add a parameter with a variable to ExecWait and use it for the message box.


hold up
can you help me out a little more? i said i am not the most savvy programmer out there, so i apologize but i need a little more guidance.


ExecWait bla.exe $R0
MessageBox MB_OK $R0


question
ok, so i did that. and in the messagebox, it says 128 half the times and says 0 half the times. any idea what these are?


They are set by the application you are running. You should check the documentation of that application.


0 usually means that the program terminated sucessfully and I can't remember what 128 stands for of the top of my head. But it will usually be an error unless the program is designed to return some special value.

Vytautas