Jump to content

Recommended Posts

Posted

I want to create a script where a arrow keys a press with delays for how long its held and when to press them.

E.G

Script Started

Up arrow held down >

Wait 500 >

Left Arrow held down >

Wait 250 >

Left Arrow Up >

Script Stopped

I've tried it using Sleep(100), but it doesn't keep the Up arrow held down constantly as it pause the script. Not delay an action.

Thanks

Flemingjp

Posted (edited)

MouseClick("Left", 300, 350, 1, 5)
sleep(2990)
Send("{UP down}")
sleep(550)
Send("{LEFT down}")
sleep(350)
Send("{LEFT up}")

The sleep is for pausing script. It won´t work.

This is what you´re after:

#include <Timers.au3>

_Timer()

Func _Timer()

    Send("#r")
    WinWaitActive("Run")
    Send("notepad.exe{Enter}")
    WinWaitActive("[CLASS:Notepad]")
    
    Global $starttime = _Timer_Init()
    
    While _Timer_Diff($starttime)<1000
        Send("Hello ... Is just an example")
        
    WEnd
EndFunc   ;==>_Timer
Edited by realshyfox

Learn, learn and ... learn

Posted (edited)

It works fine to keep the KeyDown, but it will not repeatedly press it.

Slight difference here :huh2:

Well, let´s change a little:

#include <Timers.au3>

_Timer()

Func _Timer()

    Send("#r")
    WinWaitActive("Run")
    Send("notepad.exe{Enter}")
    WinWaitActive("[CLASS:Notepad]")
    
    Global $starttime = _Timer_Init()
    
    While _Timer_Diff($starttime)<5000
        Send("Hello ... Is just an example")
        Sleep(500)
    $iIdleTime = _Timer_GetIdleTime()
    $starttime = $starttime + $iIdleTime
    WEnd
EndFunc   ;==>_Timer
Edited by realshyfox

Learn, learn and ... learn

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
  • Recently Browsing   0 members

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