apsync Posted June 11, 2005 Share Posted June 11, 2005 hmm for some reason this function is not working, i want to exit the script immediately if user has pressed cancel! Func CheckForNo($F) If $F = 2 Then Exit EndIf EndFunc $times = InputBox("", "question 1"); CheckForNo($times) $cpnaam = InputBox("", "question 2"); CheckForNo($cpnaam) $bericht = InputBox("", "question 3"); CheckForNo($bericht) it's not working, when I press cancel it still asks the next question! Link to comment Share on other sites More sharing options...
Valuater Posted June 11, 2005 Share Posted June 11, 2005 (edited) i'm not the smartest here but.... i m sure you need to "call" $times = InputBox("", "question 1"); Call ("CheckForNo($times)")....???? why not use $msg = GuiGetMsg() $times = InputBox("", "question 1"); if $msg= $Cancel_button then ExitLoop ; exits a loop If $msg = $GUI_EVENT_CLOSE then exit ; exits the program Edited June 11, 2005 by Valuater Link to comment Share on other sites More sharing options...
apsync Posted June 11, 2005 Author Share Posted June 11, 2005 thx for the reply, no i dont want to use guigetmsg, and no the call function is not working, but thanks for the reply though, anyone else? Link to comment Share on other sites More sharing options...
buzz44 Posted June 11, 2005 Share Posted June 11, 2005 (edited) 2 is the @error value, read the help file. The string returned when cancel is clicked is nothing. This works fines. I changed the "2" to '""'$times = InputBox("", "question 1"); CheckForNo($times) $cpnaam = InputBox("", "question 2"); CheckForNo($cpnaam) $bericht = InputBox("", "question 3"); CheckForNo($bericht) Func CheckForNo($F) If $F = "" Then Exit EndIf EndFuncWhat I would like to know is why this doesn't work...$times = InputBox("", "question 1") If @error = 2 Then Exit EndIf $hhh = InputBox("", "question 2")Edit: Sorry Helge. If you combine your answer and mine we would have a nice one lol. I must be tripping out. I checked the help file for the @error return for the input box function and I SWEAR it said it was 2... I check it know and it says its 1. Please disregard my stupid last "What I would like to know..." question as I was going on the assumption that @error = 2 when the cancel is pressed but really its when the timeout is reached. Edited June 11, 2005 by Burrup qq Link to comment Share on other sites More sharing options...
Helge Posted June 11, 2005 Share Posted June 11, 2005 (edited) You've not set up the script to exit when the user presses "Cancel",but when the user inputs "2". See the code below...$times = InputBox("", "question 1"); CheckForNo(@ERROR) $cpnaam = InputBox("", "question 2"); CheckForNo(@ERROR) $bericht = InputBox("", "question 3"); CheckForNo(@ERROR) Func CheckForNo($F) If NOT $F = 0 Then Exit; Quits at error EndFuncEdit : Too slow.. Anyway, you might want to check out Burrup'sscript instead of mine, as his also fails when the user haven't inputanything. If you want that..Good luck with your script ! Edited June 11, 2005 by Helge Link to comment Share on other sites More sharing options...
apsync Posted June 11, 2005 Author Share Posted June 11, 2005 thx! 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