Right Click as Toggle

Get help with using AutoHotkey and its commands and hotkeys

Right Click as Toggle

23 Apr 2014, 20:22

Hey folks,

I'm trying to figure out how to script LAlt and/or the Fn key (on a laptop) so that when I press it, it toggles right click and holds it until I press it again. Alternatively, I'm considering having my right click work like my left click with click lock enabled (works as normal unless you hold it for a couple seconds then it automatically holds it down) but that's way beyond my ability atm.

So far I've come up with this but it's not working as intended: http://bpaste.net/show/uCKjluXRPte8vNzVnOu6/

What am I doing wrong?

Also could somebody explain in simplistic terms what exactly my script is saying? I have read every resource I can but it's still quite confusing to me.
Posts: 53
Joined: 30 Sep 2013, 21:33

Re: Right Click as Toggle

24 Apr 2014, 11:19

Hey, give this a shot. It may work for you. I put in some tooltips to help remind which position you entered when pushing the alt key. This has helped me with some hotkeys I've used.

Let me know if you have any specific questions. I'm also just a beginner, so this may not be perfect or have perfect syntax/style, but it seems to work.

Also, it may be useful if you use the "["code"]" tags, minus the quotes. Just press the code button in the editor and then paste your code between the start and end tags.

Code: Select all

;Below is a proposed version of the script.
;Note that ";" allows you to add "comments" that do not get run in the  script.
#SingleInstance Force ;this makes it so only a single version of your script is running. Most people use/recommend it.

~LAlt:: ;adding the ~ allows you to maintain alt functionality while also making it trigger the script.
	GetKeyState, RtMouseUpOrDown, RButton ;this is a built in command that checks whether the key is U or D
	if (RtMouseUpOrDown = "U") ;check if our variable is equal to U for up.
		Send {RButton Down} ;if the key is up, press it down
		TTMsg("Button Down", 1000) ;sends a tooltip to the TTMsg function below
	else ;if the key is anything but up
		Send {RButton Up} ;send the button up
		TTMsg("Button Up", 1000) ;sends a tooltip to the TTMsg function


TTMsg(Message, Timer) ;example TTMsg("Testing", 1000)
	MouseGetPos ttX, ttY
	ToolTip, %Message%, ttX + 50, ttY + 50
	SetTimer, RemoveToolTip, %Timer%
		SetTimer, RemoveToolTip, Off

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Lem2001, mikeyww and 36 guests