Sign in to follow this  
Followers 0
kangbyj8481

simple hotkey operation

3 posts in this topic

hello, i just started to get familar with autoit and here's my script;

;

CODE
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?

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0