JackieMcGee Posted August 6, 2010 Share Posted August 6, 2010 Hi there,Sorry about this one...it sounds so simple - I am having real trouble with a simple msg box command.I under stand how to make gui - assign a button and then get various actions to take place when that button is pressed.However, in the example belowMsgBox(2+16, "Windows Error Example", "Choose message for each action", 5) if @error = 3 ThenRun('Notepad.exe')send('Test') if @error = 5 ThenRun('iexplore.exe') EndIfAll I am trying to do is that the error box produces three choices: Abort Retry and IgnoreUpon click clicking each error button, a different command needs to be performed.EG:Abort button should make Notepad run with text then being sent in itRETRY button should bring up IEIGNORE button should for instance bring DOS window etcI have checked the help file again and again, all I can find is that each error button has a return code ID, I have tried doing return commands, if and else etc, I just cannot seem to work out whats happening. Would really appreciate your help with this major hurdle (for me).ThanksJackie Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 6, 2010 Moderators Share Posted August 6, 2010 JackieMcGee,It is not @error that you need to trap, it is the return value from the MsgBox function. This should help make it clear:; What value does the Msg Box return? Switch MsgBox(2+16, "Windows Error Example", "Choose message for each action", 5) Case 3 MsgBox(0, "Return", "You pressed ABORT") Case 4 MsgBox(0, "Return", "You pressed RETRY") Case 5 MsgBox(0, "Return", "You pressed IGNORE") EndSwitchYou jsut put the code you want in place of the MsgBox lines in each Case.Any questions? M23P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Foxhound Posted August 7, 2010 Share Posted August 7, 2010 (edited) Alternatively you could put the message box return code in a variable: $errval = MsgBox(2+16, "Windows Error Example", "Choose message for each action", 5) if $errval = 3 Then Run('Notepad.exe') send('Test') if $errval = 5 Then Run('iexplore.exe') EndIf Edited August 7, 2010 by Foxhound [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 8, 2010 Moderators Share Posted August 8, 2010 FoxHound, I am afraid that your suggested code will not work - did you try to run it before posting? Perhaps you meant something like: $errval = MsgBox(2 + 16, "Windows Error Example", "Choose message for each action", 5) If $errval = 3 Then MsgBox(0, "Return", "You pressed ABORT") ElseIf $errval = 4 Then MsgBox(0, "Return", "You pressed RETRY") ElseIf $errval = 5 Then MsgBox(0, "Return", "You pressed IGNORE") EndIf Please do continue making suggestions in response to questions - but make sure that they run in future! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
JackieMcGee Posted August 9, 2010 Author Share Posted August 9, 2010 Thankyou to both of your for your help. I am very grateful, both ways of the script were very useful for me, a little piece of the jigsaw of the scripting stuff has now been placed and its made some things about cases, variables etc clearer for me. Not everything has clicked yet but I am trying to take it all in. Thanks a bunch Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now