2 scripts have conflicts

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

2 scripts have conflicts

27 Jun 2017, 06:31

I need a function that when holding left mouse, select texts and then click the right mouse to copy the texts. To paste the texts, I just need to double click the right mouse. I already have the scripts.
Please check the following 2 scripts. These 2 scripts can run properly and implement the function alone, but when I run them both, the 2nd script just doesn't work. I think there are conflicts in between.

The 1st script:
#NoTrayIcon
#IfWinNotActive ahk_class ConsoleWindowClass

bAllowOverride := False

~LButton::
GetKeyState, keystate, RButton
If (keystate = "D")
{
SendInput {RButton Up}
SendInput {Escape}
SendInput ^v
bAllowOverride := True
}
Return

RButton::
GetKeyState, keystate, LButton
If (keystate = "D")
{
SendInput {LButton Up}
SendInput ^c
bAllowOverride := True
Return
}
SendInput {RButton Down}
Return

RButton Up::
GetKeyState, keystate, LButton
If (keystate = "D")
{
Return
}
If (bAllowOverride)
{
bAllowOverride := False
Return
}
SendInput {RButton Up}
Return


The 2nd script:

;Double Right Click to paste
~RButton::

If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{

Sleep 200 ; wait for right-click menu, fine tune for your PC
Send {Esc} ; close it

Send ^v ; or your double-right-click action here
}

Return


It will be amazing if you could find the conflicts and make them work together in harmony. Another thing is that, the 2nd script will flash the right-click pop up window, though the function is good. It will be so nice if you could eliminate the pop-up window.

Many many thanks to who read this and can help, finger crossed.
GEV
Posts: 1002
Joined: 25 Feb 2014, 00:50

Re: 2 scripts have conflicts

27 Jun 2017, 11:28

Code: Select all

; Double Right Click to paste:
~RButton::
	If (A_PriorHotKey = "~RButton Up" and A_TimeSincePriorHotkey < 500)
	{
		CloseContextMenu := true
		KeyWait, RButton, L
		Sleep, 100
		Send ^v ; or your double-right-click action here
	}
Return

~RButton Up::
	CloseContextMenu := false
Return

~LButton & RButton::
	CloseContextMenu := true
	KeyWait, RButton, L
	KeyWait, LButton, L
	Send ^c
Return

~RButton & LButton::
	CloseContextMenu := true
	KeyWait, LButton, L
	KeyWait, RButton, L
	Send ^v
Return

#If (CloseContextMenu)

	RButton Up::
		CloseContextMenu := false
		Sleep, 30 ; or more
		Send {Escape}
	Return

#If
mrhappy

Re: 2 scripts have conflicts

27 Jun 2017, 15:53

:dance: Wow, you are so kind to help me. That script really saves a lot of my time on PC. Anyone who need this script will surely be benefited from you.
Is that possible for you to amend a little thing that when double-click right mouse, right mouse pop-up window does not show up?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, Google [Bot], jomaweb, RussF and 304 guests