Middle mouse button alternation help please

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AlexneedsHelp

Middle mouse button alternation help please

21 Jun 2018, 06:14

Hey guys just trying to figure out how to make a rebind of my middle mouse button to alternate between 2 and 3 each time i click it i wrote this code but it doesnt work any help ?


Code: Select all

 global mycount:=0
 	Mbutt_def()
 	{
 		if ((mycount/2)==0)
 			 return 3
 		else
 			return  2
	}
	 mycount:=mycount + 1 
 Loop 
 {
 	MButton::Mbutt_def()

}
User avatar
TheDewd
Posts: 1510
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Middle mouse button alternation help please

21 Jun 2018, 12:01

Code: Select all

#SingleInstance, Force

NumVar := 0

MButton::
	NumVar := !NumVar
	MsgBox, % (NumVar ? 2 : 3)
return
gregster
Posts: 9001
Joined: 30 Sep 2013, 06:48

Re: Middle mouse button alternation help please

21 Jun 2018, 12:11

If you want to fix your version with a function, you can do this:

Code: Select all

global mycount:=0

Mbutt_def()
{
   num := (Mod(mycount, 2) = 0) ? 3 : 2		; use modulo function
   mycount++ 
   return num
}
	  
MButton::send % Mbutt_def()

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 293 guests