AndreiVorcea Posted December 12, 2013 Share Posted December 12, 2013 (edited) im new in auto it and i want a litle help on my script how can i put the function in endless loop ore return until exit key is presed HotKeySet("{F10}", "first") HotKeySet("{F8}", "ExitScript") While 1 Sleep(100) WEnd Func first() Send("SPACE DOWN") Sleep(160) Send("SPACE UP") EndFunc Func ExitScript() Exit EndFunc thnx in advance for help Edited December 12, 2013 by AndreiVorcea Link to comment Share on other sites More sharing options...
bogQ Posted December 12, 2013 Share Posted December 12, 2013 (edited) Global $Should_i_Run = False;this line ($Should_i_Run is just example name that you can change to anything else if needed) HotKeySet("{F10}", "TurnOn");this line HotKeySet("{F8}", "ExitScript") While 1 Sleep(100) If Should_i_Run Then first();this line WEnd Func TurnOn();and this func Should_i_Run = True EndFunc Func first() Send("SPACE DOWN") Sleep(160) Send("SPACE UP") EndFunc Func ExitScript() Exit EndFunc Edited December 12, 2013 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
AndreiVorcea Posted December 12, 2013 Author Share Posted December 12, 2013 i dont want the while to loop,only the func part Link to comment Share on other sites More sharing options...
bogQ Posted December 12, 2013 Share Posted December 12, 2013 (edited) "while" is "the loop" but regardless of that......you can add any loop inside func itself, you have 2 more loop options that arnt "while" loops, they are "do untill" and "for to next" loops, look in help file for more info.the other way (that i dont see why anyone shud use) is recursion (google it if you need to c what recursion is) but i dont see any point of anyone using infinite func call inside itself with some exit case just for the sake of looping, it's bad to do it that way. Edited December 12, 2013 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
Solution Xenobiologist Posted December 12, 2013 Solution Share Posted December 12, 2013 Global $Should_i_Run = False;this line ($Should_i_Run is just example name that you can change to anything else if needed) HotKeySet("{F10}", "Toggle");this line HotKeySet("{F8}", "ExitScript") While 1 Sleep(100) WEnd Func Toggle();and this func $Should_i_Run = Not $Should_i_Run While $Should_i_Run Send("SPACE DOWN") Sleep(160) Send("SPACE UP") WEnd EndFunc ;==>TurnOn Func ExitScript() Exit (0) EndFunc ;==>ExitScript 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 Link to comment Share on other sites More sharing options...
AndreiVorcea Posted December 12, 2013 Author Share Posted December 12, 2013 (edited) this one works nicely, what comand shold i use instead of Send("SPACE DOWN") to keep pressed the space button for 500 miliseconds? not only send one impulse every 500 milisecond Edited December 12, 2013 by AndreiVorcea Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 12, 2013 Share Posted December 12, 2013 Try using Opt('SendKeyDownDelay', 500) 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 Link to comment Share on other sites More sharing options...
AndreiVorcea Posted December 12, 2013 Author Share Posted December 12, 2013 i used Send("{SPACE DOWN}") instead of Send("SPACE DOWN") and works like a charm! Xx Code~Mega xX u made my day,thnx! Link to comment Share on other sites More sharing options...
Xenobiologist Posted December 12, 2013 Share Posted December 12, 2013 Glad I could help. 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 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