Sign in to follow this  
Followers 0
1bobby

Return code or error code

3 posts in this topic

#1 ·  Posted (edited)

I am having problems understanding the relationship between return value and the error codes, @error I think it is. I have read the MsgBox Function Reference several times. And am still confused.

I am to the point that I need to check if someone hit the X in the top right hand corner of the window, or hit the OK button.

Further understanding of what to check for after a command or function has been executed to be able to tell if it was successful or not? I have been around long enough to know the script has to be fool proof.

Were can I locate some examples or find more information.

Thanks bobby (newbie)

Edited by 1bobby

Share this post


Link to post
Share on other sites



Hello.

I am having problems understanding the relationship between return value and the error codes, @error I think it is. I have read the MsgBox Function Reference several times. And am still confused.

@error typically is only set, if something went wrong. For Message Boxes you'll see return values dependant on what was clicked (or not: timeout...)

Use the code wizard [1] to create your msgbox. Then use a 2nd one to display the results, you'll see immediately what is happening :)

#Region --- CodeWizard generated code Start ---
;MsgBox features: Title=Yes, Text=Yes, Buttons=Abort, Retry, and Ignore, Icon=Question
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(34,"Msgbox Test","Click any button")
Select
    Case $iMsgBoxAnswer = 3 ;Abort

    Case $iMsgBoxAnswer = 4 ;Retry

    Case $iMsgBoxAnswer = 5 ;Ignore

EndSelect
#EndRegion --- CodeWizard generated code End ---

MsgBox(0,"Msgbox Results:","@Error = " & @error & @LF & _
         "$iMsgBoxAnswer = " & $iMsgBoxAnswer)

Regards, Rudi.

[1] SciTe: ALT+W


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Thanks rudi, that was just the push I needed. I was able to put some error checking to work. Thanks again, bobby

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