bustedboy Posted February 2, 2006 Posted February 2, 2006 (edited) hi guys..im kinda newb to autoit and made a script (its very basic) and nid help with it i was just wondering if u guys tell mi a statement that is paused until activation by a hot key, meaning that when i doublecick the script, it just does nothing until i press a hotkey to start it. heres my script Global $Paused HotKeySet("{PRINTSCREEN}", "TogglePause") Func TogglePause() $Paused = NOT $Paused While $Paused WEnd EndFunc While 1 Send("{LEFT down}") Send("{SPACE}") Sleep(1300) Send("{SPACE}") Sleep(2000) Send("{LEFT up}") Send("{RIGHT}") Sleep(2000) Send("{RIGHT down}") Sleep(5000) Send("{SPACE}") Send("{UP down}") Sleep(2000) Send("{UP up}") Send("{SPACE}") Sleep(1300) Send("{SPACE}") Sleep(2000) Send("{RIGHT up}") Sleep(5000) WEnd most of the statements i got help from the help option... reli appreciate if u guys could help mi...=D Edited February 2, 2006 by bustedboy
Xenobiologist Posted February 2, 2006 Posted February 2, 2006 Hi, what about HotKeySet("{F2}", "DoIt") HotKeySet("{F3}", "End") while 1 sleep(1000) wend Func DoIt() While 1 Send("{LEFT down}") Send("{SPACE}") Sleep(1300) Send("{SPACE}") Sleep(2000) Send("{LEFT up}") Send("{RIGHT}") Sleep(2000) Send("{RIGHT down}") Sleep(5000) Send("{SPACE}") Send("{UP down}") Sleep(2000) Send("{UP up}") Send("{SPACE}") Sleep(1300) Send("{SPACE}") Sleep(2000) Send("{RIGHT up}") Sleep(5000) WEnd EndFunc Func End() Exit(0) EndFunc Hope that helps So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
bustedboy Posted February 2, 2006 Author Posted February 2, 2006 yep it did help, thx alot appreciate it.....btw...have anyway to shorten the pausing part? cos i copied it direct from the help file
Jotun Posted February 2, 2006 Posted February 2, 2006 Here's another way you could do it: Global $Paused = 0 HotKeySet("{PAUSE}", "SetPause") While 1 If $Paused = 0 Then ; Do Stuff EndIf WEnd Func SetPause() If $Paused = 0 Then $Paused = 1 Else $Paused = 0 EndIf EndFunc
bustedboy Posted February 2, 2006 Author Posted February 2, 2006 oic...thx alot....erm btw..by doing that, u are actually checking if the return value of pause is 0 or not, if not den stop script? if i am wrong pls correct mi , i wanna learn more =)
Moderators SmOke_N Posted February 2, 2006 Moderators Posted February 2, 2006 yep it did help, thx alot appreciate it.....btw...have anyway to shorten the pausing part? cos i copied it direct from the help file To shorten it? It's only 4 lines of code not counting the neccessary Func/EndFunc? Func TogglePause() $Paused = NOT $Paused While $Paused Sleep(100);<<< very important not to over work your cpu WEnd EndFunc 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.
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