aphesia Posted April 5, 2009 Share Posted April 5, 2009 how can i make a msgbox which asks for yes & no and if i click no , it does smth.. if nothing happens after 10 secs it will automatically press yes or just a ok button .. if i click it smth happens, if i dont cklick it , after 10 seconds smth other will happen thx Link to comment Share on other sites More sharing options...
Paulie Posted April 5, 2009 Share Posted April 5, 2009 how can i make a msgbox which asks for yes & no and if i click no , it does smth.. if nothing happens after 10 secs it will automatically press yes or just a ok button .. if i click it smth happens, if i dont cklick it , after 10 seconds smth other will happen thx Switch MsgBox(4, "Title!", "Question?", 10) Case 6 ;Yes was pressed Case 7 ;No was pressed Case -1 ;Timed out EndSwitch Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 doesnt rly work: Switch MsgBox(4, "Title!", "Question?", 10) if Case 6 then exit endif ;Yes was pressed if Case = 7 then exit endif ;No was pressed Case -1 ;Timed out EndSwitch doesnt matter which button i press , it wont quit Link to comment Share on other sites More sharing options...
Kip Posted April 5, 2009 Share Posted April 5, 2009 Why do you change the script? The only thing you had to do is replace the comments. Anyway, "if Case = 7 then" 'Case' isn't some kind of variable, it's a statement (like If and While). "Case 7" does the job perfectly. MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 it doesnt matter if i do it with case = 7 then exit or not it closes when trying only this little script.. but somehow it doesnt work with my whole program so is this what u meant: Switch MsgBox(4, "Title!", "Question?", 10) Case 6 ;Yes was pressed Case 7 exit ;No was pressed Case -1 exit ;Timed out EndSwitch Link to comment Share on other sites More sharing options...
trancexx Posted April 5, 2009 Share Posted April 5, 2009 it doesnt matter if i do it with case = 7 then exit or notit closes when trying only this little script.. but somehow it doesnt work with my whole programso is this what u meant:Switch MsgBox(4, "Title!", "Question?", 10)Case 6;Yes was pressedCase 7exit;No was pressedCase -1exit;Timed outEndSwitchsmth is wrongpost some code from the failing script ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Kip Posted April 5, 2009 Share Posted April 5, 2009 Works perfectly: Switch MsgBox(4, "Title!", "Question?", 10) Case 6 ;Yes was pressed MsgBox(0,"sdsd","Yes") Case 7 MsgBox(0,"sdsd","Nope") exit ;No was pressed Case -1 MsgBox(0,"sdsd","Went to the bathroom again?") exit ;Timed out EndSwitch MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
yehia Posted April 5, 2009 Share Posted April 5, 2009 workarounds always have to be stupid take a look here Dim $YN = 0 $Y = MsgBox(4,"Your Title!","cool?",10) Switch $Y Case 6 $YN = 1 Case 7 $YN = 2 EndSwitch If $YN = 1 Then MsgBox(0,"Yes","U clicked Yes") Else MsgBox(0,"No","NO!") EndIf My Scripts:IE New UDFsElastic images moving under mouse (with a happy valentine's example)_FileRemoveLine Link to comment Share on other sites More sharing options...
trancexx Posted April 5, 2009 Share Posted April 5, 2009 Works perfectly: Switch MsgBox(4, "Title!", "Question?", 10) Case 6 ;Yes was pressed MsgBox(0,"sdsd","Yes") Case 7 MsgBox(0,"sdsd","Nope") exit ;No was pressed Case -1 MsgBox(0,"sdsd","Went to the bathroom again?") exit ;Timed out EndSwitchYes, works for you, but apparently it's not working for aphesia. Btw, you need to create a designer UDF. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 (edited) this is my program.. i know its a bit difficult coded #include <FF.au3>#include <reducemem.au3>Switch MsgBox(4, "Title!", "Run it?", 10)if Case 6 Then ExitEndIf;Yes was pressedif Case 7 Then ExitEndIf;No was pressedCase -1;Timed outEndSwitchOpt("WinTitleMatchMode", -2)$loaded = 0$loaded2 = 0$loaded3 = 0$loaded4 = 0$loaded5 = 0$loaded6 = 0$loaded7 = 0$1 = 0$2 = 0$3 = 0$4 = 0$5 = 0$6 = 0$7 = 0$8 = 0$9 = 0$10 = 0$name = 0$url1 = "0"$url2 = "0"$sURL = "0"$ende = 0_FFStart("http://somelinkhere.com",default,2)If _FFIsConnected() Then _FFClickImage("/gohome.png","src") If _FFLoadWait() Then $loaded = 1 WinSetState ( "firefox" , "", @SW_MAXIMIZE ) sleep(10000) EndIfwhile 1_ReduceMemory() if $loaded = 1 Then MouseClick("left", 441, 395, 1) sleep (3000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$1 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$2 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$3 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$4 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$5 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$6 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$7 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$8 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$9 = $Lettersleep(1000) $Letter = Chr(Random(Asc("a"), Asc("z"), 1)) send($Letter)$10 = $Lettersleep(1000)$name = $1 & $2 & $3 & $4 & $5 & $6 & $7 & $8 & $9 & $10 MouseClick("left", 439, 653, 1) $loaded = 0 EndIf If _FFIsConnected() Then _FFClickImage("/gohome.png","src") If _FFLoadWait() Then $loaded2 = 1 EndIf If $loaded2 = 1 Then sleep(5000) $url1 = "http://" $url2 = ".lala" $sURL = $url1 & $name & $url2 _FFStart("" & $sURL,default,2) $loaded3 = 1 EndIf if $loaded3 = 1 Then MouseClick("left", 748, 748, 1) If _FFLoadWait() Then $loaded4 = 1 $loaded3 = 0 EndIf EndIf if $loaded4 = 1 Then MouseClick("left", 648, 390, 1) If _FFLoadWait() Then $loaded5 = 1 $loaded4 = 0 EndIf EndIf if $loaded5 = 1 Then MouseClick("left", 736, 736, 1) If _FFLoadWait() Then $loaded6 = 1 $loaded5 = 0 EndIf EndIf if $loaded6 = 1 Then MouseClick("left", 609, 596, 1) if _FFLoadWait() = 0 then Sleep(3000) Else $loaded6 = 0 If _FFLoadWait() Then $loaded7 = 1 EndIf EndIf if $loaded7 = 1 Then $ende1 = $ende + 1 $ende = $ende1 if $ende1 = 4 Then _FFquit() Filemove("C:\hello.txt", "Z:\mybrute\hello.txt" ) exit Else sleep(5000) $loaded3 = 1 EndIf EndIfwend Edited April 5, 2009 by aphesia Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2009 Developers Share Posted April 5, 2009 ... did you try to implement the posted Switch/Case example? What you posted now if not even close to being valid syntax. Use au3check to help you with that. Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 this one is the only one i havent tried yet: Dim $YN = 0 $Y = MsgBox(4,"Your Title!","cool?",10) Switch $Y Case 6 $YN = 1 Case 7 $YN = 2 EndSwitch If $YN = 1 Then MsgBox(0,"Yes","U clicked Yes") Else MsgBox(0,"No","NO!") EndIf and i will do it as soon as possible but i dont have firefox on my main laptop Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2009 Developers Share Posted April 5, 2009 this one is the only one i havent tried yet:Dim $YN = 0$Y = MsgBox(4,"Your Title!","cool?",10)Switch $Y Case 6 $YN = 1 Case 7 $YN = 2EndSwitchIf $YN = 1 Then MsgBox(0,"Yes","U clicked Yes")Else MsgBox(0,"No","NO!")EndIfand i will do it as soon as possible but i dont have firefox on my main laptop Did you try the first one posted which looks to me the way to go?This scriptlet should work to but doesn't make sense to add the additional variable and If's.Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
TheOnlyOne Posted April 5, 2009 Share Posted April 5, 2009 (edited) Switch MsgBox(4, "Title!", "Run it?", 10) if Case 6 Then Exit EndIf ;Yes was pressed if Case 7 Then Exit EndIf ;No was pressed Case -1 ;Timed out EndSwitch switch that to this: Switch MsgBox(4, "Title!", "Run it?", 10) Case 6 Then Exit EndIf ;Yes was pressed Case 7 Then Exit EndIf ;No was pressed Case -1 ;Timed out EndSwitch Edited April 5, 2009 by TheOnlyOne Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2009 Developers Share Posted April 5, 2009 (edited) Switch MsgBox(4, "Title!", "Run it?", 10) if Case 6 Then Exit EndIf ;Yes was pressed if Case 7 Then Exit EndIf ;No was pressed Case -1 ;Timed out EndSwitch switch that to this: Switch MsgBox(4, "Title!", "Run it?", 10) if Case 6 Then Exit EndIf ;Yes was pressed if Case 7 Then Exit EndIf ;No was pressed Case -1 ;Timed out EndSwitchHave you even tried this before posting? (or did you paste the wrong code in the second section?) Would be nice if people refrain from posting these confusing contributions. Jos Edited April 5, 2009 by Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 ye i tried the first one Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2009 Developers Share Posted April 5, 2009 ye i tried the first one. (Jesus, this is like "Pulling teath")OK. Now help us to help yourself: What was the problem with that ? what went wrong ? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 (edited) just try it with my script.. it doesnt work if i only try the first sctip.. ye np but try it with my programm.. it wont work.. thats what i wrote already 2 times Edited April 5, 2009 by aphesia Link to comment Share on other sites More sharing options...
Kip Posted April 5, 2009 Share Posted April 5, 2009 (edited) I don't get it anymore, you edit your posts after someone responded to it... confusing. And it also seems that you love putting a Case statement in a If. The only thing you had to do was replacing the comments. Couldn't be easier, but you still managed to find a way to screw it up. Edited April 5, 2009 by Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API. Link to comment Share on other sites More sharing options...
aphesia Posted April 5, 2009 Author Share Posted April 5, 2009 (edited) i havent edited anything after some answer.. the only thing i want to do is to get this yes no timeout thingy working with MY programm if i only use this script u posted it works.. but if i include it into my script it wont exit Edited April 5, 2009 by aphesia 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