HELP <3 Move Mouse on LButton IF RButton is pressed

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
thakyle
Posts: 2
Joined: 07 Dec 2022, 17:10

HELP <3 Move Mouse on LButton IF RButton is pressed

Post by thakyle » 07 Dec 2022, 17:21

Found this little guy right here on the forums but i was wondering how i could change the Leftbutton:: function to work only if RightButton is being held down. Tried If GetkeyState and Else but it outputs an error that says the Else has no IF.... clearly I'm missing somethings.

Works Flawlessly other than the fact I would like it to only work when the R mouse button is HELD when you press the LeftButton

Code: Select all

Gui, Add, Text, xm ym+3, Hotkey:
Gui, Add, Hotkey, xm+40 ym vHotkeyC w240, % HotkeyCC := "End"
Hotkey, End, CheckBox
Gui, Add, Text, xm ym+33, Speed:
Gui, Add, Edit, xm+40 ym+30 vSpeed w240 ,1
Gui, Add, CheckBox, xm+200 ym+67 vED gCheckBox, Toggle Script
Gui, Add, Button, xm ym+60 w100, Apply Changes
Gui, Show, w300

Hotkey, LButton, LeftButton, Off
Hotkey, LButton Up, LeftButtonUp, Off
Return

GuiClose:
ExitApp

LeftButton:
    Gui, Submit, NoHide
    SendInput, {LButton Down}
    SetTimer, DragDown, % 10 / Speed
Return

LeftButtonUp:
    SendInput, {LButton Up}
    SetTimer, DragDown, Off
Return

DragDown:
    Gui, Submit, NoHide
    DllCall("mouse_event", "UInt", 0x01, "UInt", 0, "UInt", 1 + Speed)
Return

CheckBox:
    Gui, Submit, NoHide
    If (A_ThisHotkey = HotkeyCC)
        GuiControl,, ED, % !ED
    Gui, Submit, NoHide
    Stat := (ED) ? "On" : "Off"
    Hotkey, LButton, % Stat
    Hotkey, LButton Up, % Stat
Return

ButtonApplyChanges:
    Gui, Submit, NoHide
    If (HotkeyC != HotkeyCC) {
        Hotkey, % HotkeyCC, CheckBox, Off
        Hotkey, % HotkeyCC := HotkeyC, CheckBox, On
    }
Return

User avatar
mikeyww
Posts: 26951
Joined: 09 Sep 2014, 18:38

Re: HELP <3 Move Mouse on LButton IF RButton is pressed

Post by mikeyww » 07 Dec 2022, 19:16

Code: Select all

hk = LButton
Hotkey, RButton & %hk%, LeftButton, On
RButton::RButton
LeftButton:
Send x
Return

Post Reply

Return to “Ask for Help (v1)”