Sign in to follow this  
Followers 0
lyledg

Shellexecute and exitcode question

5 posts in this topic

Guys

I am trying to use the ShellExecuteWait function, and the example from the helpfile shown below works well and returns a meesage box stating the exit code of zero

$val = ShellExecuteWait("Notepad.exe")

; script waits until Notepad closes
MsgBox(0, "Program returned with exit code:", $val)oÝ÷ Øz0z÷«-ëwöƲ¶­¶W°jÉèµú.Ö¬²0·¥£®¶­sbb33c·fÂÒ6VÆÄWV7WFUvBgV÷C´æ÷FWBæVRgV÷C² £²67&BvG2VçFÂæ÷FWB6Æ÷6W0¤×6t&÷ÂgV÷Cµ&öw&Ò&WGW&æVBvFWB6öFS¢gV÷C²Âb33c·fÂ

All I get is a normal windows error, but no exit code. (See attached pic)

The reason I need this exit code for no file found is that with the current app I am writing, I need to write meaningful messages to the event viewer...so in this case a "file not found" won't give me a exit code, but only a gui message

How could I rectify this?

Cheers

post-2827-1201834805_thumb.jpg

Share this post


Link to post
Share on other sites



$val = ShellExecuteWait("Notepad.ee")

; script waits until Notepad closes

MsgBox(0, "Program returned with exit code:", @ERROR)

Share this post


Link to post
Share on other sites

All I get is a normal windows error, but no exit code.

You need a file to run to get an exitcode from it. As weaponx shows, @error can silently pick up the error instead of the msgbox if RunErrorsFatal Opt is set off (apparently latest beta has it off as default).

Share this post


Link to post
Share on other sites

Thanks for putting me onto the right track mate

:)

Share this post


Link to post
Share on other sites

Thanks Mhz..I have a Include file (See attahced which can give the exit code)

I compiled this not long ago

Cheers

Exitcodes.au3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0