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
Related
Im trying to make an ahk script to try and simplify a one time use script. Pretty much im running over 1000 commands in a game one after one another .Currently I have something like this. I have all the commands in a single text file just not with any ahk coding.
.waypointadd 1 100234 40 -469
.waypointadd 2 99549 34 5
.waypointadd 3 100615 37 -160
.waypointadd 4 100817 27 -457
.waypointadd 5 100503.5 10.5 -647.5
.waypointadd 6 100494.5 10.5 -625.5
This goes on for a while. Im new to using expressions and such and am pretty much trying to make it to press enter, type the command, then press enter, then go to the next one. I obviously cant do this manually. I have tried using some basic replace expressions and stuff but not really sure how to do this.
In the end i would want it to look like this
send {enter}
send (command 1)
send {enter}
send {enter}
send (command 2)
send {enter}
you could bind it to a key like....
1::
loop, 1 {
send {enter}
send (command 1)
send {enter}
send {enter}
send (command 2)
send {enter}
}
or make a function when you a press a key. lmk if this helps or not
doSomething() {
send {enter}
send (command 1)
send {enter}
send {enter}
send (command 2)
send {enter}
}
1::
doSomething()
You could store all the commands in your clipboard (CTRL+C them) and then loop through all of them:
Loop, Parse, Commands, `n, `r ;split by linefeed, ignore carriage return
{
SendInput, % A_LoopField "{Enter 2}"
Sleep, 1000 ;however long you need
}
Loads of ways to get the commands into your script, I just went with loading them from your clipboard, should be pretty easy convenient to just copy the block of commands you want and then starting the script.
Then there's a parsing loop.
And then SendInput is used to send the current command follow by two presses of Enter.
Alternatively, if your game supports pasting from clipboard, it would be nice to just load your clipboard with whatever you want to send, and then sending a CTRL+V.
If the code with SendInput is going too fast, you can try switching over to normal Send and maybe even using SetKeyDelay to add even more delay between the keypresses.
I want to write an AutoHotkey script which loop a key X number of times.
For example, here's is a script which overwrites the function of ENTER key with function of F2 key in File Explorer.
#IfWinActive ahk_class CabinetWClass
Enter::
Send, {F2}
#IfWinActive ahk_class CabinetWClass
Enter::
Send, {ENTER}
#IfWinActive
The goal is to press ENTER to rename a select file, and then press ENTER to confirm the rename. Pressing ENTER on the same file that have just been renamed should send F2 key again (In case there is typo error).
Currently the second block doesn't work as I'm sending the same key, how to fix this?
The KeyWait command is your friend in this case.
There is still room to improve on how you handle the second Enter
#IfWinActive ahk_class CabinetWClass
$Enter::
sleep,100 ; giving time to detect the first Enter
Send, {F2}
Keywait, Enter, T5 D ; wait 5 seconds for the Enter to be pressed down
If (ErrorLevel == 0)
{
Send, {Enter}
sleep 200
Send, {F2}
}
else
{
traytip, , timeout ; Enter was not pressed down in 5 seconds
}
return
Basically, it appears you're trying to assign different tasks to the same hotkey and due to this being done seperately ahk is selecting one of the tasks and running with that task and only that task. If loops can be used within hotkeys, so I would suggest using this to rotate between the two expected outcomes. Please see example below:
temp:= 1
enter::
if(temp==1)
{
Send, {ENTER}
temp:=2
}
else if(temp==2)
{
Send, {F2}
temp:=1
}
return
1::
Temp:=1
return
2::
temp:=2
return
^x::ExitApp
I also added in hotkeys for 1/2 to allow you to manually decide the outcome rather than it being specifically assigned in the case of any issues.
Oh, and ctrl+x to close the macro.
You're trying to rebind the enter key twice.
Rebinding a key is like saying "When I press this key, do this:" - in this case it's under an #IfWinActive so it's more like "When this window is open and I press this key..."
When you break that down you have "When I press enter - press F2" as well as "When I press enter, press enter"
What you're wanting to achieve is make the rebind conditional - i.e. it only sends F2 under certain conditions.
It's hard to know how to help without more context. Is there any reason you can't use a different key combination? Like Ctrl + Shift + Enter?
Something like:
+^Enter::send, {F2}
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
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".
Well i want to make a script with the objetive:
3{DOWN} key, and later hold or quickly press Z x3, and loop all that.
I have been trying to work with loop command but i just can't, im new with AutoHotkey and english it's not my native languague so it's been pretty hard.
Here is the code i tried but didn't work as i expect, since it press Z before the 3 {DOWN} keys.
#Persistent
SetTimer, Code, 150
Return
Code:
Send, Z{DOWN}
Return
If you know anyway to improve what i'm doing like, add a toggle like F8 to turn on/off, it would be aweosome.
Thanks for any help.
Helena.
Helena, What your script does right now is the following. As soon as the script starts it will start to send [Z] and [Arrow down] every 150 mili seconds. This is independent of what application is running at that time.
You write that you want to loop sending codes and that you want to toggle this ON/OFF.
Here is an example that comes closer to your goal.
#Persistent
F8:: ; This is your [F8] Toggle hotkey
If Toggle:=!Toggle ; Here you "test" the value of the variable "toggle" and after testing switch it to the opposite (true/false)
SetTimer, Trigger, -1 ; This is to create a separate thread for the loop. -1 means start in 1 ms but only do this one time, not every 1 ms's.
return
Trigger:
While (Toggle)
{
Send, +z{Down} ; + is the shift key, thus +z makes captial Z
Sleep, 500 ; Wait 500 ms (1/2 a second)
Send, +{z Down} ; Press Shift z Down. This will NOT start a repeat like ZZZZZZZZZZZZZZZZ
Sleep, 500 ; Wait 500 ms (1/2 a second)
Send, +{z Up} ; Lift Shift z Up
Sleep, 1 ; Required. Without it The F8 keypress to toggle off can not be read anymore
}
Return