RadioBoy Posted February 23, 2007 Posted February 23, 2007 I have a question. How would you make a macro script in which when you hit a hotkey, such as F4, and it begins spamming text like "HI" over and over in a continuous loop until you hit another hotkey such as F6? I know it's a newbie question... but I tried searching already and came up with nothing. Thank you for even bothering to read this topic because I can't imagine the frustration you have pros have to deal with against newbies like me everyday.
RadioBoy Posted February 23, 2007 Author Posted February 23, 2007 (edited) HotKeySet('{F3}', 'Spam') HotKeySet('{F4}', 'Stop') HotKey('{ESC}, 'Exit') Func Spam() Do Send('SPAM' & '{ENTER}') Until ? EndFunc Func Stop() ExitLoop EndFunc Func Exit() Exit EndFunc So far this is my horrible noob script. -.- Edited February 23, 2007 by RadioBoy
Shevilie Posted February 23, 2007 Posted February 23, 2007 Do a search for pause Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
RadioBoy Posted February 23, 2007 Author Posted February 23, 2007 (edited) I assume you were trying to lead me to your post in this topic. Well, I read up on it, so I decided to try rewriting the script based off of the script you posted and off of my own assumtions.Would this work?$spam = HotKeySet('{F3}', 'Spam') $exit = HotKeySet('{ESC}', 'Close') Func Spam() While 1 $msg = GUIGetMsg() Select Case $msg = $spam Do Send('SPAM' & '{ENTER}') $msg = GUIGetMsg() Until $msg = $stop MsgBox(0,0,0) Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc Func Close() Exit EndFunc Edited February 23, 2007 by RadioBoy
Gondus Posted February 23, 2007 Posted February 23, 2007 Global $paused HotKeySet( "{PAUSE}", "TogglePause") ; Put any scripting here ; when you hit the pause key it will stop everthing your script is doing till you hit pause again Func TogglePause() $paused = Not $paused While $paused Sleep(100) ToolTip('PROGRAM IS PAUSED', 500, 100);Not nessesary but i like the tool tip WEnd EndFunc -----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran
Hello Me You Posted February 23, 2007 Posted February 23, 2007 Global $paused HotKeySet( "{PAUSE}", "TogglePause") ; Put any scripting here ; when you hit the pause key it will stop everthing your script is doing till you hit pause again Func TogglePause() $paused = Not $paused While $paused Sleep(100) ToolTip('PROGRAM IS PAUSED', 500, 100);Not nessesary but i like the tool tip WEnd EndFuncHow does it understand what $paused is? Random
SadBunny Posted February 23, 2007 Posted February 23, 2007 How does it understand what $paused is?It doesn't. $paused is used as a boolean variable in this script, meaning it can have true or false for a value. The statement $pause = not $pause means that the state is inverted (toggled). If it was true before, it is false after, and v.v.. Then the script does something if $pause is true (it pauses, obviously ). Roses are FF0000, violets are 0000FF... All my base are belong to you.
Shevilie Posted February 23, 2007 Posted February 23, 2007 A more correct / readable way would be like this Global $paused = FALSE HotKeySet( "{PAUSE}", "TogglePause") ; Put any scripting here ; when you hit the pause key it will stop everthing your script is doing till you hit pause again Func TogglePause() $paused = Not $paused While $paused Sleep(100) ToolTip('PROGRAM IS PAUSED', 500, 100);Not nessesary but i like the tool tip WEnd EndFunc Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
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