m0nster Posted April 18, 2006 Share Posted April 18, 2006 Hello, I'm new to AutoIt, or any programming language for that matter, and I have a small issue where I want to set a hotkey to emulate 100 key presses, but also be able to hit a seperate hotkey to stop it at anytime while it's doing so. I already tried, but failed. Is this possible? Or could it possibly be an error in my coding? Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 18, 2006 Share Posted April 18, 2006 (edited) Hello,I'm new to AutoIt, or any programming language for that matter, and I have a small issue where I want to set a hotkey to emulate 100 key presses, but also be able to hit a seperate hotkey to stop it at anytime while it's doing so. I already tried, but failed.Is this possible? Or could it possibly be an error in my coding?Hi & welcome,that should be possible. Please show what you've got so far. Then it is much easier to help at the right point. So long,Mega Edited April 18, 2006 by th.meger 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...
Thatsgreat2345 Posted April 18, 2006 Share Posted April 18, 2006 well yes it is possible just have it call one function to start all the key press and then another hotkey to go to a pause function... cant whip you up an example cuz i got to go to school Link to comment Share on other sites More sharing options...
m0nster Posted April 18, 2006 Author Share Posted April 18, 2006 (edited) Well, I tried that method, but it didn't work, so I made another hotkey/function to terminate (exit) the script along with the main function that repeats the key 100 times. While it was repeating, I tried the hotkey to terminate the script, but it didn't work. So, that made me think it wasn't possible. I'll give it another look over when I get back to school and post the source if I still haven't debugged it. Thanks guys! Edited April 18, 2006 by m0nster Link to comment Share on other sites More sharing options...
Valuater Posted April 18, 2006 Share Posted April 18, 2006 maybe ; Press Esc to terminate script, Pause/Break to "pause" Global $Paused HotKeySet("{PAUSE}", "TogglePause"); to send the z's HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage");Shift-Alt-d ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Running"',0,0) Send("{Z}") WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"thanks...",",,, Valuater.", 2) EndFunc sends z until paused or exited 8) Link to comment Share on other sites More sharing options...
Confuzzled Posted April 20, 2006 Share Posted April 20, 2006 (edited) Algorithm: Define both your hotkeys. Put the key press inside a loop that is processed 100 times and the loop is exited early if the other key is pressed. Post what you have so far - you may already have a working script with just a typo, or you may have the logic wrong. We cannot tell without looking at it. The help file is your friend. Edited April 20, 2006 by Confuzzled 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