Not sure how to add additional button press.

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pewpewi
Posts: 3
Joined: 28 Jul 2021, 00:47

Not sure how to add additional button press.

28 Jul 2021, 01:06

Hi there, hope you all well.

I have script as below that presses ctrl after I hold in Left Mouse Button after a certain amount of time.

Code: Select all

~$LButton::
KeyWait, LButton, T1.30
If (ErrorLevel)
{
  while GetKeyState("LButton")
  {
  ; if not GetKeyState("LCtrl")
  Send {LCtrl Down}
  KeyWait, LButton
  Send {LCtrl Up}
  }
}
return
[Mod edit: [code][/code] tags added.]

My goal is to also press shift and hold it down and release when I push/release Left Mouse button. While keeping the above script active as is.

I currently have the hold in shift script but I wish to consolidate the two scripts into one. See below.

Code: Select all

~$LButton::
Send, {Shift down}{LButton down}
KeyWait, LButton
Send, {LButton up}{Shift up}
return
Hope the explanation will suffice.

Lovely day all.

Regards pewi
Rohwedder
Posts: 7644
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Not sure how to add additional button press.

28 Jul 2021, 06:18

Hallo,
try:

Code: Select all

~$LButton::
Send, {Shift down}
KeyWait, LButton, T1.30
If (ErrorLevel)
{
	while GetKeyState("LButton")
	{
		; if not GetKeyState("LCtrl")
		Send {LCtrl Down}
		KeyWait, LButton
		Send {LCtrl Up}
	}
}
KeyWait, LButton
Send, {Shift up}
return
pewpewi
Posts: 3
Joined: 28 Jul 2021, 00:47

Re: Not sure how to add additional button press.

28 Jul 2021, 06:46

Brilliant, will give it a go as soon as I am able to.
pewpewi
Posts: 3
Joined: 28 Jul 2021, 00:47

Re: Not sure how to add additional button press.

29 Jul 2021, 00:34

Hi sir,

Hope you are well.

It worked like a charm. Thank you very much.

Regards,

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen and 317 guests