Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Holding down the left mouse button in AutoHotkey

Tags:

autohotkey

I want a script where pressing F1 makes AutoHotkey hold down the left mouse button. I then want the script to release the mouse once I press the key again.

How can I do that?

like image 915
Pizza Overflow Avatar asked Jan 02 '10 21:01

Pizza Overflow


People also ask

What is left mouse button in AutoHotkey?

The left mouse button when used with Send, but the primary mouse button when used with hotkeys. In other words, if the user has swapped the buttons via system settings, LButton:: is physically activated by clicking the right mouse button, but Send {LButton} performs the same as physically clicking the left button.

How do I trigger an AutoHotkey script?

Run a ScriptDouble-click a script file (or shortcut to a script file) in Explorer. Call AutoHotkey.exe on the command line and pass the script's filename as a command-line parameter. After creating the default script, launch AutoHotkey via the shortcut in the Start menu to run it.


1 Answers

I would use Click down and Click up

Click is generally preferred over MouseClick because it automatically compensates if the user has swapped the left and right mouse buttons via the system's control panel.

F1::
    alt := not alt
    if (alt)
    {
        Click down
    }
    else
    {
        Click up
    }
Return
like image 113
DaMacc Avatar answered Oct 06 '22 23:10

DaMacc