simple q how to release another button while clicking inside a script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
maxkill
Posts: 158
Joined: 11 Apr 2016, 13:03

simple q how to release another button while clicking inside a script

Post by maxkill » 31 Jan 2023, 17:58

I got this code so it holds lbutton down until i click it releases it

How can I also make it release the ctrl button and send it up once I click the left mouse button?

I tried making it work but it wouldn't release the ctrl button can someone show the command line to release the ctrl button upon clicking the mouse while inside the script?

(Might not even be correct lol but it works to hold down lbutton.)

Code: Select all

send {ctrl down}
Send % (toggle := !toggle) 
     ? "{LButton Down}" 
     : "{LButton Up}"

If (GetKeyState("lbutton", "P"))
{
		send, {LButton Down}
 }
else
send, {lbutton down}

User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: simple q how to release another button while clicking inside a script

Post by mikeyww » 31 Jan 2023, 18:30

Code: Select all

~LButton::
Send {Ctrl up}
SoundBeep 1500
Return
If the LButton is down, then you want to send LButton down?

maxkill
Posts: 158
Joined: 11 Apr 2016, 13:03

Re: simple q how to release another button while clicking inside a script

Post by maxkill » 31 Jan 2023, 21:08

mikeyww wrote:
31 Jan 2023, 18:30

Code: Select all

~LButton::
Send {Ctrl up}
SoundBeep 1500
Return
If the LButton is down, then you want to send LButton down?
just keep it pressed down thankyou

it didn't work your advice. upon clicking my mouse it's still pressed down the ctrl button. besides won't that keep send lctrl up every time you press mouse (if it would work), I only need it to do that once

User avatar
mikeyww
Posts: 26880
Joined: 09 Sep 2014, 18:38

Re: simple q how to release another button while clicking inside a script

Post by mikeyww » 31 Jan 2023, 21:45

The intent of your script is not at all clear.

What my script does:
make it release the ctrl button and send it up once I click the left mouse button

maxkill
Posts: 158
Joined: 11 Apr 2016, 13:03

Re: simple q how to release another button while clicking inside a script  Topic is solved

Post by maxkill » 01 Feb 2023, 16:49

mikeyww wrote:
31 Jan 2023, 21:45
The intent of your script is not at all clear.

What my script does:
make it release the ctrl button and send it up once I click the left mouse button
after many hours I managed a solution because of the bugged out ralt down that kept being pressed down. this is from a 'hold left mouse and hold lctrl' position to release both after rctrl is held down first then left mouse button clicked down and both released at same time releases everything and sends the code

Code: Select all

~rctrl & lbutton::
KeyWait lbutton 
send {lbutton up}
mousemove, kx, ky, 1
loop, 4
send {lctrl up}
send {rctrl up}
Return

Post Reply

Return to “Ask for Help (v1)”