Jump to content

Recommended Posts

Posted

I want it to hold space down for 3 seconds but it only sends space once. what is wrong with this script?

Func Pickup()
    ControlSend($GameTitle, "", "", "{SPACE down}")
    sleep(3000)
    ControlSend($GameTitle, "", "", "{SPACE up}")
endfunc
Posted

This is another question. Did your code worked in first place? You need to specify the ClassNN to successfully send keystrokes to the control.

Yes, my first code did work but it only sends 1 character. As if its presing it once and not really holding it.

In response to your first post, that is the behavior you should expect. Holding a key and letting it go produces one character. If you want to repeat it, you have to add messages for repeating.

I see...so in order to do what i want i would have to play with sleeps and more sends?? or a loop?

Posted

Correct me if I'm wrong:

Opt('SendKeyDownDelay', 20)

Run('notepad')
WinWaitActive('Untitled')
Dim $hWnd = WinGetHandle('Untitled')

Dim $iInit = TimerInit()
Do
    ControlSend($hWnd, '', 'Edit1', '{a down}')
Until TimerDiff($iInit) > 2000
ControlSend($hWnd, '', 'Edit1', '{a up}')

ControlSend($hWnd, '', 'Edit1', '{ENTER}')

Opt('SendKeyDownDelay', 100)

$iInit = TimerInit()
Do
    ControlSend($hWnd, '', 'Edit1', '{a down}')
Until TimerDiff($iInit) > 2000
ControlSend($hWnd, '', 'Edit1', '{a up}')

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
×
×
  • Create New...