Jump to content

How to press a key down and hold it?


Recommended Posts

Hello.   I'm new to autoit. I've read the AutoIt Help and got confused about using the function send and HotKeySet.

What I want to do is to press w+shift on keyboard and hold them on a window-mode online game for 20 minutes,

and I also need another key (such as F11) to activite the action.

Now I face with 2 problems,

1. Opt("SendKeyDownDelay", 2000)
    Send("{w down}")

    functions above can't make the W key holding for 2 seconds. 

2.HotKeySet doesn't seem to function as I expect. It just doesn't work.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.14.5
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

;Script Start - Add your code below here
HotKeySet("{F11}","f11")
Func f11()
 ToolTip("这是一个工具提示", 0, 0)
HotKeySet("{F11}")
sleep(2000)
Opt("SendKeyDownDelay", 2000)
  Send("{w down}")
 HotKeySet("{F11}","f11")
EndFunc

I know those are quite low-level questions but I've been stuck in them for three hours.

Thanks for any help.

Link to comment
Share on other sites

  • Moderators

@Lenged you read the help file but seem to have missed the forum rules. Please read them now, especially the part about game automation, and you will see why this thread is locked.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...