Help with Script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Rez
Posts: 4
Joined: 12 Feb 2020, 19:22

Help with Script

Post by Rez » 01 Jun 2023, 21:57

The goal of this code is to autoclick my Left Mouse Button while I am holding it down.
While the main goal of this is achieved it breaks when I have other buttons such as Shift held down. Im wondering if anyone would be able to help me figure out a way to make the GetKeyState to work with my LButton while I am holding another button such as Shift. Im not sure if there is something I can add to it or a different function but any help would be appreciated.

Code: Select all

0::
  AToggle := !AToggle
  return

#If AToggle
$~LButton::
  while GetKeyState("LButton", "P") {
    Click
    Sleep 100
  }
  return
#If
[Mod action: Topic moved from "Ask for Help (v2)" since this is v1 code.]

Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help with Script

Post by Rohwedder » 02 Jun 2023, 00:19

Hallo,
replace $~LButton:: by: $*~LButton:: or:

Code: Select all

#InstallMouseHook
0::SetTimer, Clicker,% (AToggle:=!AToggle)?100:"Off"
Clicker:
Click,% GetKeyState("LButton","P")
Return

Rez
Posts: 4
Joined: 12 Feb 2020, 19:22

Re: Help with Script

Post by Rez » 02 Jun 2023, 12:20

Rohwedder wrote:
02 Jun 2023, 00:19
Hallo,
replace $~LButton:: by: $*~LButton:: or:

Code: Select all

#InstallMouseHook
0::SetTimer, Clicker,% (AToggle:=!AToggle)?100:"Off"
Clicker:
Click,% GetKeyState("LButton","P")
Return
Thank you for this, while adding that asterisk did not work the script that you wrote appears to work perfectly. I appreciate it very much.

Post Reply

Return to “Ask for Help (v1)”