Jump to content

Recommended Posts

Posted

I want to make a macro that spams up, down, up, down,... that's simple enough to make but i want it to only execute when i hold down a key.

lets say that key is w. if i hold down w, the macro will spam up, down until i let go of w.

Posted (edited)

#include <Misc.au3>

Local $hDLL = DllOpen("user32.dll")

While 1
    If _IsPressed("10", $hDLL) Then
        ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
        ; Wait until key is released.
        While _IsPressed("10", $hDLL)
            Sleep(250)
        WEnd
        ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
    ElseIf _IsPressed("1B", $hDLL) Then
        MsgBox(0, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(200)
WEnd

DllClose($hDLL)

This is directly from the help file and looks like you could easily insert and function into it to simply spam the keys you are after WHILE it is pressed... Look at the line with sleep(250)

Edited by Keltset

-K

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...