Jump to content
Sign in to follow this  

Make _IsPressed() like HotKeySet?

Recommended Posts


Hello, I'm creating a way to move your mouse cursor with the arrow keys. I would like it so the keys don't let windows perform the functions they normally do. I do not want to use HotKeySet() because there is a delay in the action ending. I am using


If _IsPressed() Then
MouseMove(x, y+1, 0)

You get the idea. So, is there a way to make it so only my functions happen when these buttons are pressed?

Edited by Donald8282

Share this post

Link to post
Share on other sites

Try something like that:

#include <Misc.au3>
HotKeySet("{ESC}", "_Exit")

$dll = DllOpen("user32.dll")
$speed = 1
$acc = 1

While Sleep(10)
    $aMPos = MouseGetPos()
    If _IsPressed("25", $dll) And _IsPressed("12", $dll) Then ;alt + left
        MouseMove($aMPos[0] - $speed, $aMPos[1])
        $speed += $acc
    ElseIf _IsPressed("27", $dll) And _IsPressed("12", $dll) Then ;alt + right
        MouseMove($aMPos[0] + $speed, $aMPos[1])
        $speed += $acc
    ElseIf _IsPressed("26", $dll) And _IsPressed("12", $dll) Then ;alt + up
        MouseMove($aMPos[0], $aMPos[1] - $speed)
        $speed += $acc
    ElseIf _IsPressed("28", $dll) And _IsPressed("12", $dll) Then ;alt + down
        MouseMove($aMPos[0], $aMPos[1] + $speed)
        $speed += $acc
        $speed = 1

Func _Exit()



Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.