script to use Left Click as Left Shift does not work correctly - autohotkey

I've search AHK forums but couldn't solution.
The script I found on AHK to use LShift as LButton does not work correctly..when press & hold left shift and move the mouse pointer, it can't copy text exactly like as if click and hold left mouse. What I mean by exactly is.. press & hold left shift and move the mouse pointer copies the whole paragraph or section of text..not just the few words I wanted.
My first time here & newbie w/ AHK. Your time is appreciated.
~Lshift::
Send {LButton}
return
F10::exitapp

you could try:
~Lshift::
Send {LButton Down} ; Press the LButton key Down
KeyWait, LShift ; Wait for the LShift key to be lifted
Send {LButton Up} ; Release the LButton key
return
F10::exitapp

Related

AHK script to change RButton Behavior

I want to make a script that would allow me to click once every time I press the mouse, however, if instead of letting go immediately, I hold the RMB for more than 0.25s it would click again on release.
Essentially allowing me to use RMB normally as long as I don't hold it for too long but allowing me to do a double click if held.
This is a work around since my mouse's button gets stuck if I click too fast and I'm not able to get a new one atm.
The purpose of this is to be able to use my mouse on PS and to play the one game i play some times: Black Ops 2 while i save enough for a new mouse. In the context of the game, i want to be able to use Toggle ADS as a base and be able to use the toggle by default by just clicking but be able also do a Hold to ADS with the same button on the fly without changing the game's configuration.
I am not very proficient at AHK and this is all I got so far, holding works fine, however if I don't hold, it does a double click which is annoying.
RButton Down::
Send {Click, Right}
keywait RButton, t.25
if errorlevel
keywait RButton,
Send {RButton Up}
return
You could maybe do some trickery with multiple KeyWaits, but I wouldn't recommend time consuming processing inside hotkey labels in any case due to AHKs single threaded nature.
Here's something very simple I'd recommend instead:
~*RButton::RClickTime := A_TickCount
~*RButton Up::
if (A_TickCount - RClickTime >= 250)
Click, Right
return
So first when we press down RButton (note that there is no "down" state for hotkey names, the key name itself means it being pressed down) we store the current system time with A_TickCount.
And we use the ~ modifier for the hotkey so the keypress itself isn't consumed.
And the * modifier is used so holding down e.g. Ctrl or Shift, etc, wouldn't make the hotkey not work.
Then on RButton release (RButton Up::) we compare the current system time with the stored system time to see if over 250ms passed. If so, we send another right click with Click, Right (don't use a send command here, it isn't really intended for this).
It looks like you're missing some curly braces around your if block; but I think you can implement the right double-click functionality with something as simple as,
RButton::
KeyWait RButton, T.25
numberOfClicks := errorLevel + 1
Send {Click Right %numberOfClicks%}
return
~RButton:: ;*When Right Mouse Button is Down, do the following.*
keywait RButton, T.25 ;*Wait (250 milliseconds) for it to be released.*
if errorlevel { ;*When it exceeds the said time*
keywait RButton ;*Wait for it to be released*
Send, {RButton Up} ;*Send Right Mouse Button up*
}
return

Autohotkey Click and hold RMB+W macro

I'm trying to make a macro that clicks and holds "W" key and "RMB" when "RMB" is being held.
So far I've came up with something like this:
RButton::
if( not GetKeyState("RButton" , "P") )
Click, down, right
Send {w down}
return
RButton Up::
Click, up, right
Send {w up}
This only holds "W" key, but not "RMB".
I would appreciate some help.
RMB - Right mouse button

Press both mouse buttons when holding left click

When I hold down left mouse button I would like for the right mouse button be held down also.
The right mouse would then release when the left mouse is no longer being held. So both buttons can be controlled simultaneously with the left click.
LButton::RButton means Left Button acts like your Right Button. The ~ modifier means "Fire the hotkey as well as whatever it's remapped to".
~LButton::RButton
Quick edit: If you need it to activate after Left Button has been held for a certain amount of time, use this:
; Time for LButton to be held down before RButton is sent (in milliseconds)
waitTime := 500
return
~*LButton::
while GetKeyState("LButton", "P")
if (A_TimeSinceThisHotkey > waitTime){
Send, {RButton Down}
KeyWait, LButton
Send, {RButton Up}
}
return

Bind one key to three modifier keys autohotkey

i wannna be able to press Alt+Middle Button for simulating Shift+Ctrl+Right Button with AutoHotkey. I did it for simulating two keys. And it worked but it is not working for three keys.
so i wrote that:
LAlt & MButton::Send {Ctrl Down}{Shift Down}{RButton Down}
keywait, LAlt
keywait, MButton
LAlt & MButton Up::Send {Ctrl Up}{Shift Up}{RButton Up}
return
where is the problem?
First thing is that the two keywait lines are never executed as you have your send action on the some line as the hotkey, this will make a one-line hotkey or remap
If you wish to execute multiple lines of code in one hotkey routine you will need to start the routine on the line below the hotkey definition label.
Also try taking a simpler approach be using Autohotkeys remapping capabilities
Can't say this will work for you but give it a shot
!MButton::^+RButton
Hope it helps

Conditionally intercept a mouse click in Autohotkey?

I want to have a script which will intercept a mouse click and send a key press instead, but only when the capslock key is toggled on. I want the mouse click to be sent normally if the capslock key is toggled off.
Currently I have made this:
$LButton::
if GetKeyState("CapsLock", "T") = 1
send, {a}
else
send, {LButton}
return
The problem with this is that when the capslock key is off, the left button can click perfectly normally but it cannot drag.
If I change $ to ~, it is able to drag but it also performs a click when the capslock key is toggled on.
Is there any way to make the script ignore the click completely if the capslock key is toggled off?
AHK_L's #If will give you what you want:
#If GetKeyState("CapsLock", "T")
LButton::Send, a
With this code, you won't have to bother what happens when capslock is off. AHK will intercept the click on a lower level and let it trickle through.
How to use the symbol UP.
SetBatchLines, -1 ; you pretty much have to include this to speed up the execution
LButton::
if( GetKeyState("CapsLock", "T") )
tooltip, ignore left click
else
send, {LButton Down}
return
LButton UP::
send, {LButton Up}
return