Page 1 of 1

Simulate CTRL+Double-Click with Middle-Click [SOLVED]

Posted: 19 Oct 2015, 16:27
by chinagreenelvis
All I want to do is simulate either CTRL+double-click or CTRL+enter by double-clicking the middle mouse button in Windows Explorer. I'm trying to get a double-middle-click to open folders in a new window.

So far I can simulate a left-click:

Code: Select all

#IfWinActive ahk_class CabinetWClass
~MButton::
if (A_PriorHotkey <> "~MButton" or A_TimeSincePriorHotkey > 200)
{
	KeyWait, Esc
    return
}	
SendInput {LButton}
return
Nothing else I add to this seems to do the trick. I've tried

Code: Select all

SendInput {LButton}{Ctrl Down}{Enter}{Ctrl Up}
It only seems to be sending the {Enter} and not the CTRL press.

Re: Simulate CTRL+Double-Click with Middle-Click

Posted: 19 Oct 2015, 17:53
by Heezea
Try this:

Code: Select all

#IfWinActive ahk_class CabinetWClass
~MButton::
	if (A_PriorHotkey <> "~MButton" or A_TimeSincePriorHotkey > 200)
	{
		KeyWait, Esc
		return
	}	
	SendInput {LButton}
	Sleep 100
	Send ^{Enter}
return

Re: Simulate CTRL+Double-Click with Middle-Click

Posted: 19 Oct 2015, 18:29
by chinagreenelvis
Thanks. That produced inconsistent results, but it got me to the solution:

Code: Select all

#IfWinActive ahk_class CabinetWClass
~MButton::		
	if (A_PriorHotkey <> "~MButton" or A_TimeSincePriorHotkey > 200)
	{
		KeyWait, Esc
		return
	}	
	Send {Click}
	Sleep 100
	Send ^{Enter}
return
Also, it turns out the real problem is that I needed to delete the following line from the new script file (provided by the template):

Code: Select all

SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

Re: Simulate CTRL+Double-Click with Middle-Click [SOLVED]

Posted: 20 Oct 2015, 08:14
by Heezea
Nice job.