kangbyj8481 Posted December 29, 2008 Share Posted December 29, 2008 hello, i just started to get familar with autoit and here's my script; ; CODEHotKeySet( "P", "Multipress") While 1 Sleep(50) WEnd Func Multipress() While Send( "X" [, 1] ) Sleep(50) WEnd EndFunc ; Basically what I am trying to do is make alphabet "P" on keyboard a hotkey for pressing alphabet "X" multiple times in short amount of time. I read some instruction on the help menu and created this script, but it doesn't work, can you help me? Link to comment Share on other sites More sharing options...
Zedna Posted December 29, 2008 Share Posted December 29, 2008 Try this: HotKeySet( "P", "Multipress") While 1 Sleep(50) WEnd Func Multipress() Send( "{X 3}" ) ; send X 3times EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 29, 2008 Share Posted December 29, 2008 hello, i just started to get familar with autoit and here's my script; HotKeySet( "P", "Multipress") While 1 Sleep(50) WEnd Func Multipress() While Send( "X" [, 1] ) Sleep(50) WEnd EndFunc ; Basically what I am trying to do is make alphabet "P" on keyboard a hotkey for pressing alphabet "X" multiple times in short amount of time. I read some instruction on the help menu and created this script, but it doesn't work, can you help me? 1. The function Send() does not return anything, so it can't be the control for a While/WEnd loop. 2. Don't copy functions literally from the help file; "[, 1]" indicates an optional parameter that you don't need. 3. The While/WEnd loop inside your Multipress() function needs a way to exit (not loop forever). How long did you want "X" to be repeated, or how many times did you want it to be hit? 4. Here is a fixed example that hits "X" every 0.5 seconds, exactly 10 times: Func Multipress() For $n = 1 To 10 Send("X") Sleep(500) Next EndFunc ;==>Multipress 5. Here is an example hitting "X" continuously for 10 seconds: Func Multipress() Local $iTimer = TimerInit() While TimerDiff($iTimer) < 10000; 10 seconds Send("X") WEnd EndFunc ;==>Multipress 6. Welcome to AutoIt. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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