I am trying to make a script where, when I press the mouse one time, it will wait 120 milliseconds, then double tab Q. The problem is when I make the bind hooked up to my mouse1 it is overriding Counter-Strike and it wont shoot. It just double taps Q. Can anyone help me?
Insert::
Suspend
Return
LButton::
Sleep, 1000
if (GetKeyState("LButton"))
Send, q
Sleep, 30
Send, q
I believe that you still want counter strike to detect the mouse click also.
To do so, add a ~ in front of LButton::.
Result : ~LButton::
~ tells autohotkey to not block the hotkey's native function.
See more about Hotkey prefix symbols here: http://ahkscript.org/docs/Hotkeys.htm#Symbols
Related
I would like to make a script that would react to a short LShift press and send the "(". It should only happen if LShift is pressed shortly. If it is pressed for a longer than 500ms, for example, then it should not send anything and continue working as a regular LShift.
This way I want to utilize the short Shift press that does not do anything for now.
I tried to experiment with KeyWait but it did not really work. Do I need to introduce the timer variable or is there an easier way of doing it?
Thanks!
I would use something like that:
~LShift::
KeyWait, LShift
if A_TimeSinceThisHotkey <= 500
Send, (
return
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
I am using lightroom for this hotkey. I dont know why is this doesn't work for me.
::{control}{sleep 5}{shift}{sleep 5}v
And Alt+F+↓(5x) then Enter.
And Alt+F+↓(5x) then Enter.
I don't know what you mean by that, because I can't see anything like that in your script. So I will just ignore it and do what the thread title and your script says/implies.
The following script will simulate pressing Ctrl+Shift+V when you press the A key
SetKeyDelay, 5 ;wait 5 milliseconds between every keystroke
a::^+v
About your comment, I guess I know what you are on to, try this:
SetKeyDelay, 5 ;wait 5 milliseconds between every keystroke
2::
SendInput, !f
Sleep, 50
SendInput, {Down}{Down}{Down}{Down}{Down}{Enter}
Return
I am using AutoHotkey. This Program I want to use left side numpad in my script but I couldn't use it.This case is important because I play a game and that game use left side numpad,not right side. (Right side numpad doesn't work in this game)
This is my code;
SendMode Input
~control::
Loop
{
if GetKeyState("e") ; If this statement is true, the user has physically released the F1 key.
break ; Break out of the loop.
send,{Numpad8}
Sleep 200
send,1
Sleep 200
}
return
Any idea?
Edit = I don't know how can I show this problem. How can you understand this Send command press left side's numpad or right side? I play Knight Online game and I can try these methods in the game.Code works or not.But could you try it ?
Here you have all the keys AutoHotkey handles:
http://www.autohotkey.com/docs/commands/Send.htm
Just change send,{Numpad8} to Send,{1}
You can also try to simulate a keypress this way (The last time I used AutoHotkey I had to do it):
Send, {1 down}
Sleep 100
Send, {1 up}
And also, you can try to send the keystrokes directly to the window this way:
wintitle = WINDOW TITLE
Controlsend,,{1 down}, %wintitle%
Sleep 100
Controlsend,,{1 up}, %wintitle%
THe window title can be the starting characters of the window. For example, if the window title is "This is a game", you can set as window title in your script "This is a".
language: Autohotkey on Win7
"Shift" plus "right mouse button" plus "mouse wheel up"
I want my hotkey to be holding those three keys simultaneously. I have tried the following without any success
+ & rbutton & wheelup::
send 6
+rbutton & wheelup::
send 6
shift & rbutton & wheelup::
send 6
I always get an error when I try to make this hotkey does anyone know how to do it?
I'm still a newbie but I'll try and help =].
It doesn't seem to work when you use a modifier key with two mouse buttons, so this is a way that kind of works:
+WheelUp::
KeyWait, RButton, D ; Waits for RButton to be pressed down.
MsgBox, This works!
Return
The problem is it clicks (or releases) the right mouse button once the hotkey has run. If you instead put it like so:
+RButton::
KeyWait, WheelUp, D
There will be another problem in that it will work fine for the first use of the hotkey, it will from then on work with only Shift + Right Mouse Button, because it's already waited for WheelUp to be pressed down (or rather scrolled up).
I mucked around for a little bit with GetKeyState and the like but still being new I can't find a way around it xD. These may be sufficient for what you need for now, otherwise better to wait for someone more knowledgeable to post.
With the information from your comment (hold Shift+right and spam WheelUp) following solution works fine. Use Shift + WheelUp and check if the right mosue button is down.
+WheelUp::
if (GetKeyState("RButton", "P"))
send 6
else
send +{WheelUp}
return
You could remove the else part and add a ~ modifier, but then Shift + WheelUp will be catched and blocked by AHK even if you dont press the right mouse button.