lyledg Posted November 25, 2004 Share Posted November 25, 2004 Guys How to I get the result from a "Yes, No" msgbox? What I am trying to do is if a user clicks "No", it mus loop back to the original code, but if they click "Yes", continue the rest of code? I am going insane! Link to comment Share on other sites More sharing options...
SlimShady Posted November 25, 2004 Share Posted November 25, 2004 Look in the help file.It contains information that helps you with all the functions. Link to comment Share on other sites More sharing options...
erebus Posted November 25, 2004 Share Posted November 25, 2004 Try to use functions. For example: ; Script start ;...blah blah... ;Here is the function you want to be repeated if the user presses No... MyFunc() ;MsgBox goes here $test = MsgBox(4,"Title","Press YES to continue or NO to repeat the last step") If $test = 7 Then; 7 means "NO" was pressed MyFunc() EndIf ...rest of code goes here...; means the user has pressed YES ; End of your code Func MyFunc() ;here ;is your function's code EndFunc ; End of script Link to comment Share on other sites More sharing options...
trids Posted November 25, 2004 Share Posted November 25, 2004 (edited) Here's what you need form the MsgBox() topic in the helpfile ..Return ValueSuccess: Returns the ID of the button pressed. Failure: Returns -1 if the message box timed out.Return Value Button Pressed 1 = OK 2 = CANCEL 3 = ABORT 4 = RETRY 5 = IGNORE 6 = YES 7 = NO 10 = TRY AGAIN ** 11 = CONTINUE ** HTH Edit: Sample code:( .. there's none in the helpfile! <-- opportunity for enhancement, someone?);stuff before the question ;stuff before the question ;stuff before the question While MsgBox(4096 + 4 + 32,@ScriptName,"Ready to continue?") = 7 ; 7 = NO sleep(10) Wend ;continue stuff ;continue stuff ;continue stuff Edited November 25, 2004 by trids Link to comment Share on other sites More sharing options...
erebus Posted November 25, 2004 Share Posted November 25, 2004 I assume that he probably wanted a way to "goto" his code... Not quite sure though Link to comment Share on other sites More sharing options...
SlimShady Posted November 25, 2004 Share Posted November 25, 2004 What I am trying to do is if a user clicks "No", it mus loop back to the original code, but if they click "Yes", continue the rest of code? $Yes = 6 $No = 7 ;Your code here ;Prompt user for an answer $Answer = MsgBox(64 + 3, @ScriptName, "Do you want to exit?") If $Answer = $Yes Then ;Do stuff Exit;if you want ElseIf $Answer = $No Then ;Do stuff EndIf Link to comment Share on other sites More sharing options...
trids Posted November 25, 2004 Share Posted November 25, 2004 I assume that he probably wanted a way to "goto" his code...<{POST_SNAPBACK}>You're right - I was just being lazy Here's the reason we don't need GOTOs ..Do ; <-- equivalent of a GOTO destination ;stuff until user says YES ;stuff until user says YES ;stuff until user says YES ;stuff until user says YES Until MsgBox(4096 + 4 + 32,@ScriptName,"Ready to continue?") = 6 ; 6 = YES Link to comment Share on other sites More sharing options...
lyledg Posted November 25, 2004 Author Share Posted November 25, 2004 Thanks Guys, you all have helped HEAPS!! 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