I'm attempting to send three keys (Alt, Shift, Q) at same time using this script:
:*:pk:: ;
Send, {AltDown}{ShiftDown}{qDown}
return
When I run this is it does not release the keys, it seems like the Alt button remains pressed. After the above keys are pressed I then want to press the "q" character again (separately, not at same time).
How can I amend my script above to achieve this?
When using Down, you must also send an Up to the same key or else it will remain pressed. This can be achieved like this:
:*:pk::
Send, {Alt Down}{Shift Down}{q Down}{Alt Up}{Shift Up}{q Up}
Send, {q}
Related
SC039::Send {LShift down}
SC039 Up::
Send, {LShift up}
Send, {Space}
Return
I expect this to do the following: when pressing the spacebar, it acts like the shift key. When I release it, I get one space bar press. Unfortunately, when I stay on the space bar, I get a bunch of spaces even though the key is never released. How can this expected behavior be implemented?
You need the * modifier(docs) so the hotkey is recongnized even if extra modifiers are held down (Shift)
Also, why are you using using the scancode?
*Space::SendInput, {LShift Down}
*Space Up::SendInput, {LShift Up}{Space}
Check dual-key "SpaceFN" keyboard layout https://github.com/lydell/spacefn-win
Probably this is what you are looking for or even more.
I have a very simple script to try and remap my AppsKey (the one on the right hand side of the keyboard, between WinKey and Ctrl) to Shift + F2 for the Uplay overlay.
AppsKey::
Send, +{F2}
Return
As you can see, it's very basic, however, when I try to use it in-game (Far Cry 3 in this instance), it works erratically. Like sometimes when I press the AppsKey, the overlay opens. Sometimes it doesn't and I have to repeatedly tap the AppsKey for it to finally show up or close.
No, my AppsKey isn't broken. I tried mapping it to something else and it works without problems. I just want some lead as to why it's acting erratically in this case.
Per the comments, the solution should be akin to this:
AppsKey::
SendInput, {Shift down}{F2 down}
Sleep, 50
SendInput, {Shift up}{F2 up}
return
I am new to stackoverflow and apologize in advance if what I am trying to explain is unclear.
I have tried multiple ways to make this work but have had no success so far.
I am trying to achieve the following:
When F3 is held and left arrow is pressed, left arrow will be pressed twice with no pause (0sec).
When F3 is held and right arrow is pressed, right arrow will be pressed twice with no pause (0sec).
Here's an alternative to Blauhirn's
F3::
While (GetKeyState("F3", "P")) {
If (GetKeyState("Left", "P"))
SendInput, {Left}
If (GetKeyState("Right", "P"))
SendInput, {Right}
}
Return
Alternatively you don't need to Loop to send multiples of of the same key.
You can simply use SendInput, {Left 4} the number represents the number of times that key will be sent.
Edit:
Oops, I didn't address the issue of delay between key presses. So I changed Send to SendInput as that has no delay between key presses.
~F3 & ~left::
send {left}
return
does this work?
This means, that as soon as f3 and left is pressed together, left will be sent a second time. If you want to repeat the send {left}command, use it like
loop, 4 ; 4 times
{
send {left}
}
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
I'm kinda new at this. I have a mouse with only 3 keys that I'd like to write a script for to allow me to use the right mouse button like a "browser back" key if clicked, while still retaining the original function if held for a longer period of time.
RButton::
sleep 400
GetKeyState, state, RButton
if state = U
send {Browser_Back}
else
send {RButton}
keywait, RButton
return
Currently, all my script above does now is activates the "browser back" function, regardless of time held down. I think there's a problem with the key being repeated at the send {RButton} line, but adding a $ to RButton:: didn't seem to help (if it was supposed to, idk.) If I replace the 3 "RButton" instances (not including the one on the send line) with a key on the keyboard, it works perfectly though. Help would be appreciated. Thanks.
Adjusted the code from BlackHolyMan's response to fix it. In case anybody was curious or wanted it, here it is:
RButton::
KeyWait, RButton, U T0.5
If !ErrorLevel
{
send {Browser_Back}
return
}
else
{
send {RButton Down}
KeyWait, RButton
send {RButton up}
}
return
Hi this may be just about what you need
RButton::
KeyWait, RButton, U T0.5
If !ErrorLevel
send {Browser_Back}
else
{
send {RButton Down}
KeyWait, RButton
send {RButton up}
}
return
Still some things you may need to fix as i did not test it for long...