meamrussian Posted December 30, 2005 Share Posted December 30, 2005 Here's the code: Func this() Do Send ("{tab}") Send ("{enter}") Sleep (23000) Send ("{ALT} + {F4}") $x = 0 $x = $x + 1 Until $x = 50 Endfunc HotKeySet ("{pause}", "this") While 1 WendThis is for a browser. When it presses enter, it opens a new window and waits. Then, I want it to close the window and go to the next link. However, the window just doesn't want to close What am I doing wrong? I would do WinClose ("Firefox"), but there is always more than one firefox window open. How do I close that top window to go back to the original? Also, what's the code to press pause again (or another key) to stop the script? Thanks a bunch. Link to comment Share on other sites More sharing options...
NegativeNrG Posted December 30, 2005 Share Posted December 30, 2005 (edited) Also, what's the code to press pause again (or another key) to stop the script?To be honest, thats the part i only understand. Anyway: Func this() $stop = 0 Do Send ("{tab}") Send ("{enter}") Sleep (23000) Send ("{ALT} + {F4}") $x = 0 $x = $x + 1 Until $x = 50 Endfunc HotKeySet ("{pause}", "this") hotkeyset("{INS}","pause") Func pause() if $stop = 0 Then $stop = 1 Else $stop = 0 Endif EndFunc While 1 Wend Pressing Insert will pause the script Also, if you want to make it pause on 1 key only then use Func something();;Where something is your func $stop = NOT $stop While $stop ;;do stuff here WEnd EndFunc Edited December 30, 2005 by NegativeNrG [size=20]My File Upload[/size]Register at my site and upload. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 30, 2005 Moderators Share Posted December 30, 2005 Send ("{ALT} + {F4}") = Send("!{F4}") Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 30, 2005 Moderators Share Posted December 30, 2005 Here's the code: Func this() Do Send ("{tab}") Send ("{enter}") Sleep (23000) Send ("{ALT} + {F4}") $x = 0 $x = $x + 1 Until $x = 50 Endfunc HotKeySet ("{pause}", "this") I didn't look past Send ("{ALT} + {F4}") till just now... In your loop you have: $x = 0 << put this before the loop. $x = x + 1 Until $x = 50 << $x will never = anything but 0 and 1 Func this() Local $x = '' Do Send ("{tab}") Send ("{enter}") Sleep (23000) Send ("!{F4}") $x = $x + 1 Until $x = 50 Endfunc Try that Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
seandisanti Posted December 30, 2005 Share Posted December 30, 2005 Send ("{ALT} + {F4}") = Send("!{F4}")actually i think Send ("{ALT} + {F4}") = Send("{ALT}{SPACE}{LSHIFT DOWN}{SPACE}{LSHIFT UP}{F4}") Link to comment Share on other sites More sharing options...
LxP Posted December 31, 2005 Share Posted December 31, 2005 Another way of instructing the active window to close: WinClose('') 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