Bind one key to three modifier keys autohotkey - 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

Related

Bind to key release without repeat

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.

Autohotkey remapping Alt Gr to Win Modifyer

I am trying to build a very simple AutoHotkey script but it doesnt seem to be working. I've bought a keyboard with no Win key and no programable hardware layer so I am planning on using AHK to remap the Alt Gr key to the Windows key.
Can anypoint give me pointers to where I am going wrong.
<^>!l::
MsgBox Win L pressed.
return
<^>!r::
Send {# down}
Send {r down}
Send {# up}
Send {# up}
return
<^>!e::
SendInput #&e
return
Using your middle example, it'd be like so:
<^>!r::
SendInput, {LWin Down}r{LWin Up}
Return
You can use RWin or LWin per your preference since it really shouldn't matter at the software level.

Using Send doesn't always work in AutoHotKey?

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

Sending and releasing multiple keys at once using AutoHotkey

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}

Autohotkey - multiple scripts and different language issues

I use autohotkey to simplify copying, using Alt+W instead of Ctrl+C. However, I often switch my keyboard to a Hebrew layout, so the w key is now the ' key. Then the autohotkey script for w doesn't work.
I tried to write a second script into the same file but it doesn't get activated when I press Alt+' when I'm in the Hebrew layout. I'm not sure whether it's my syntax or something else, any ideas?
This is my code:
!w::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
!'::
Send, {ctrl down}{a down}{a up}{c down}{c up}{ctrl up}
return
Thanks!
Catching Alt-' with the code you used works in other keyboard layouts (like the German layout) so your syntax looks OK to me.
To solve your problem I'd start the autohotkey help file.
Read "List of Keys, Mouse Buttons, and Joystick Controls"
where the section on "Special Keys" explains how to attempt
to catch inrecognized keys via the "keyboard hook".
Basically it describes how to find out the !' scancode which
you then can use as a hotkey alternative.
It is worth to try to use the virtual/scan codes of keys, instead names, This example uses the virtual code (vkXX):
;~ SetKeyDelay, keyDelay:=25, pressDuration:=25 ; details for SendEvent mode.
!vk57:: ; w/'/я... (en/he/ru...)
Send, {CtrlDown}{vk41}{vk43}{CtrlUp}
KeyWait, vk57
;~ Do something by release this key, if necessary...
Return