I need help with a macro

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
shitcake96
Posts: 8
Joined: 02 Mar 2021, 09:43

I need help with a macro

Post by shitcake96 » 02 Mar 2021, 09:48

I'm totally new to having a PC, let alone creating a macro. I've heard AHK is the best of the best, but it isn't really noob friendly. All I need is to know how to create a macro that when I press XButton2, it holds XButton1, and when I press it again, it releases it. I have no idea how hard this is to do, but help would be greatly appreciated!

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

Re: I need help with a macro

Post by mikeyww » 02 Mar 2021, 10:52

Code: Select all

XButton2::Send % "{XButton1 " ((on := !on) ? "down" : "up")  "}"

shitcake96
Posts: 8
Joined: 02 Mar 2021, 09:43

Re: I need help with a macro

Post by shitcake96 » 02 Mar 2021, 11:20

mikeyww wrote:
02 Mar 2021, 10:52

Code: Select all

XButton2::Send % "{XButton1 " ((on := !on) ? "down" : "up")  "}"
Didn't work for some reason...

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

Re: I need help with a macro

Post by mikeyww » 02 Mar 2021, 11:40

As a test, you can try the following in Notepad. It has the braces removed, so that you can see the text.

Code: Select all

XButton2::Send % "XButton1 " ((on := !on) ? "down" : "up")  ""

Post Reply

Return to “Ask for Help (v1)”