autohotkeyahk | holding a mouse-button to hold another key?
up vote
1
down vote
favorite
win10_v1803.17134.345_home
autohotkeyahk_v1.1.30.00
How to hold w when holding XButton1 on Logitech G502 using AutoHotKey? Problem is when holding the key with the script below it just sends a single output and not producing typical Windows-behavior which is really holding it (see below for example). Keep in mind that just because i'm intentionally using this for the purpose of playing fps games, but globally remapping it is much easier than including every game I so happen to play to be part of changing the LogitechG502's control buttons.
I think it's cool to move forward in-game while grabbing hot cheetos with my other hand
PROBLEM
- I don't have a way to remap
XButton1
on my LogitechG502 to replicate holdingw
- ahk-while command works but doesn't behave properly and acts as a press-release-press-release really fast even when slowed down using ahk-sleep
- see below for solution on setting up several ahk-commands to remap LogitechG502's XButton1 to w to move forward while ingame
SOLUTION
- This pre-requisite code behaves properly, but needs to be defined as per
gametitle
(only if there was a way to globally re-map it). Not only that, but doesn't work for all games like Killing Floor 2 as Counter-strike Global Offensive csgo works so far.
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
SAMPLE
- notworking:
XButton1::SendInput, w ; mouse advanced button back as holding forward in-game
- Holding for 3-sec, XButton1 (w/ script above) gives me:
w
- Holding for 3-sec, w gives me:
wwwwwwwwwwwwwwwwwwwwwwwwww
- Holding for 3-sec, XButton1 (w/ script above) gives me:
- worksbuttoofast:
$XButton1::
while GetKeyState("XButton1", "P")
Send w
return
- doesn't replicate holding
w
properly as this method is way faster of a repeat even when slowed down by ahk-sleep
keyboard mouse autohotkey gaming
add a comment |
up vote
1
down vote
favorite
win10_v1803.17134.345_home
autohotkeyahk_v1.1.30.00
How to hold w when holding XButton1 on Logitech G502 using AutoHotKey? Problem is when holding the key with the script below it just sends a single output and not producing typical Windows-behavior which is really holding it (see below for example). Keep in mind that just because i'm intentionally using this for the purpose of playing fps games, but globally remapping it is much easier than including every game I so happen to play to be part of changing the LogitechG502's control buttons.
I think it's cool to move forward in-game while grabbing hot cheetos with my other hand
PROBLEM
- I don't have a way to remap
XButton1
on my LogitechG502 to replicate holdingw
- ahk-while command works but doesn't behave properly and acts as a press-release-press-release really fast even when slowed down using ahk-sleep
- see below for solution on setting up several ahk-commands to remap LogitechG502's XButton1 to w to move forward while ingame
SOLUTION
- This pre-requisite code behaves properly, but needs to be defined as per
gametitle
(only if there was a way to globally re-map it). Not only that, but doesn't work for all games like Killing Floor 2 as Counter-strike Global Offensive csgo works so far.
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
SAMPLE
- notworking:
XButton1::SendInput, w ; mouse advanced button back as holding forward in-game
- Holding for 3-sec, XButton1 (w/ script above) gives me:
w
- Holding for 3-sec, w gives me:
wwwwwwwwwwwwwwwwwwwwwwwwww
- Holding for 3-sec, XButton1 (w/ script above) gives me:
- worksbuttoofast:
$XButton1::
while GetKeyState("XButton1", "P")
Send w
return
- doesn't replicate holding
w
properly as this method is way faster of a repeat even when slowed down by ahk-sleep
keyboard mouse autohotkey gaming
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
win10_v1803.17134.345_home
autohotkeyahk_v1.1.30.00
How to hold w when holding XButton1 on Logitech G502 using AutoHotKey? Problem is when holding the key with the script below it just sends a single output and not producing typical Windows-behavior which is really holding it (see below for example). Keep in mind that just because i'm intentionally using this for the purpose of playing fps games, but globally remapping it is much easier than including every game I so happen to play to be part of changing the LogitechG502's control buttons.
I think it's cool to move forward in-game while grabbing hot cheetos with my other hand
PROBLEM
- I don't have a way to remap
XButton1
on my LogitechG502 to replicate holdingw
- ahk-while command works but doesn't behave properly and acts as a press-release-press-release really fast even when slowed down using ahk-sleep
- see below for solution on setting up several ahk-commands to remap LogitechG502's XButton1 to w to move forward while ingame
SOLUTION
- This pre-requisite code behaves properly, but needs to be defined as per
gametitle
(only if there was a way to globally re-map it). Not only that, but doesn't work for all games like Killing Floor 2 as Counter-strike Global Offensive csgo works so far.
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
SAMPLE
- notworking:
XButton1::SendInput, w ; mouse advanced button back as holding forward in-game
- Holding for 3-sec, XButton1 (w/ script above) gives me:
w
- Holding for 3-sec, w gives me:
wwwwwwwwwwwwwwwwwwwwwwwwww
- Holding for 3-sec, XButton1 (w/ script above) gives me:
- worksbuttoofast:
$XButton1::
while GetKeyState("XButton1", "P")
Send w
return
- doesn't replicate holding
w
properly as this method is way faster of a repeat even when slowed down by ahk-sleep
keyboard mouse autohotkey gaming
win10_v1803.17134.345_home
autohotkeyahk_v1.1.30.00
How to hold w when holding XButton1 on Logitech G502 using AutoHotKey? Problem is when holding the key with the script below it just sends a single output and not producing typical Windows-behavior which is really holding it (see below for example). Keep in mind that just because i'm intentionally using this for the purpose of playing fps games, but globally remapping it is much easier than including every game I so happen to play to be part of changing the LogitechG502's control buttons.
I think it's cool to move forward in-game while grabbing hot cheetos with my other hand
PROBLEM
- I don't have a way to remap
XButton1
on my LogitechG502 to replicate holdingw
- ahk-while command works but doesn't behave properly and acts as a press-release-press-release really fast even when slowed down using ahk-sleep
- see below for solution on setting up several ahk-commands to remap LogitechG502's XButton1 to w to move forward while ingame
SOLUTION
- This pre-requisite code behaves properly, but needs to be defined as per
gametitle
(only if there was a way to globally re-map it). Not only that, but doesn't work for all games like Killing Floor 2 as Counter-strike Global Offensive csgo works so far.
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
SAMPLE
- notworking:
XButton1::SendInput, w ; mouse advanced button back as holding forward in-game
- Holding for 3-sec, XButton1 (w/ script above) gives me:
w
- Holding for 3-sec, w gives me:
wwwwwwwwwwwwwwwwwwwwwwwwww
- Holding for 3-sec, XButton1 (w/ script above) gives me:
- worksbuttoofast:
$XButton1::
while GetKeyState("XButton1", "P")
Send w
return
- doesn't replicate holding
w
properly as this method is way faster of a repeat even when slowed down by ahk-sleep
keyboard mouse autohotkey gaming
keyboard mouse autohotkey gaming
edited 2 days ago
asked Nov 2 at 11:48
fohrums
76311
76311
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28
add a comment |
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
This should work:
; maximum number of hotkeys that can be pressed within 2 seconds (default rate of hotkey activations)
; without triggering a warning dialog:
#MaxHotkeysPerInterval 10000
$XButton1::
while GetKeyState("XButton1", "P")
{
Send w
Sleep 20 ; ms or more if you want to reduce the frequency of the send command
}
return
Untested.
https://autohotkey.com/docs/commands/While.htm
https://autohotkey.com/docs/commands/_MaxHotkeysPerInterval.htm
Tested working, but it is really fast and replacingSend
toSendInput
is even faster. It isn't the same behavior as holdingw
. I am also not understanding the reason for the pound-sign line with the interval10000
.
– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with theahk-while
, but perhaps a way to just hold down a key?
– fohrums
Nov 4 at 13:04
add a comment |
up vote
2
down vote
Try also the remapping:
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
Replace Title of my game
with the exact title of the game window as shown in Window Spy.
https://autohotkey.com/docs/commands/_IfWinActive.htm
EDIT:
You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys for more than one applications/windows:
#If WinActive("Title of my game1") || WinActive("Title of my game2") ; "||" means "OR"
XButton1::w
XButton2::x
#If WinActive("Title of my game3")
XButton1::a
XButton2::b
#If ; turn off context sensitivity
; In all other applications/windows you can make XButton1 and XButton2 to do something else, e.g.:
XButton1:: Send ^c ; copy
XButton2:: Send ^v ; paste
https://autohotkey.com/docs/commands/_If.htm
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each(gametitle)
. So the lines w/ the poundsign is needed including the last line#ifwinactive
?
– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
This should work:
; maximum number of hotkeys that can be pressed within 2 seconds (default rate of hotkey activations)
; without triggering a warning dialog:
#MaxHotkeysPerInterval 10000
$XButton1::
while GetKeyState("XButton1", "P")
{
Send w
Sleep 20 ; ms or more if you want to reduce the frequency of the send command
}
return
Untested.
https://autohotkey.com/docs/commands/While.htm
https://autohotkey.com/docs/commands/_MaxHotkeysPerInterval.htm
Tested working, but it is really fast and replacingSend
toSendInput
is even faster. It isn't the same behavior as holdingw
. I am also not understanding the reason for the pound-sign line with the interval10000
.
– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with theahk-while
, but perhaps a way to just hold down a key?
– fohrums
Nov 4 at 13:04
add a comment |
up vote
2
down vote
This should work:
; maximum number of hotkeys that can be pressed within 2 seconds (default rate of hotkey activations)
; without triggering a warning dialog:
#MaxHotkeysPerInterval 10000
$XButton1::
while GetKeyState("XButton1", "P")
{
Send w
Sleep 20 ; ms or more if you want to reduce the frequency of the send command
}
return
Untested.
https://autohotkey.com/docs/commands/While.htm
https://autohotkey.com/docs/commands/_MaxHotkeysPerInterval.htm
Tested working, but it is really fast and replacingSend
toSendInput
is even faster. It isn't the same behavior as holdingw
. I am also not understanding the reason for the pound-sign line with the interval10000
.
– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with theahk-while
, but perhaps a way to just hold down a key?
– fohrums
Nov 4 at 13:04
add a comment |
up vote
2
down vote
up vote
2
down vote
This should work:
; maximum number of hotkeys that can be pressed within 2 seconds (default rate of hotkey activations)
; without triggering a warning dialog:
#MaxHotkeysPerInterval 10000
$XButton1::
while GetKeyState("XButton1", "P")
{
Send w
Sleep 20 ; ms or more if you want to reduce the frequency of the send command
}
return
Untested.
https://autohotkey.com/docs/commands/While.htm
https://autohotkey.com/docs/commands/_MaxHotkeysPerInterval.htm
This should work:
; maximum number of hotkeys that can be pressed within 2 seconds (default rate of hotkey activations)
; without triggering a warning dialog:
#MaxHotkeysPerInterval 10000
$XButton1::
while GetKeyState("XButton1", "P")
{
Send w
Sleep 20 ; ms or more if you want to reduce the frequency of the send command
}
return
Untested.
https://autohotkey.com/docs/commands/While.htm
https://autohotkey.com/docs/commands/_MaxHotkeysPerInterval.htm
edited Nov 3 at 13:10
answered Nov 2 at 13:36
user3419297
1,636257
1,636257
Tested working, but it is really fast and replacingSend
toSendInput
is even faster. It isn't the same behavior as holdingw
. I am also not understanding the reason for the pound-sign line with the interval10000
.
– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with theahk-while
, but perhaps a way to just hold down a key?
– fohrums
Nov 4 at 13:04
add a comment |
Tested working, but it is really fast and replacingSend
toSendInput
is even faster. It isn't the same behavior as holdingw
. I am also not understanding the reason for the pound-sign line with the interval10000
.
– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with theahk-while
, but perhaps a way to just hold down a key?
– fohrums
Nov 4 at 13:04
Tested working, but it is really fast and replacing
Send
to SendInput
is even faster. It isn't the same behavior as holding w
. I am also not understanding the reason for the pound-sign line with the interval 10000
.– fohrums
Nov 3 at 11:58
Tested working, but it is really fast and replacing
Send
to SendInput
is even faster. It isn't the same behavior as holding w
. I am also not understanding the reason for the pound-sign line with the interval 10000
.– fohrums
Nov 3 at 11:58
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
You can reduce the frequency of the send command within the loop by adding a sleep (time before repeating the send command) in it. See the edited answer.
– user3419297
Nov 3 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with the
ahk-while
, but perhaps a way to just hold down a key?– fohrums
Nov 4 at 13:04
That does help with it being fast, but when testing it in-game I get movefoward-stop-moveforward-stop action. It's not the right type of behavior i'm looking for. Maybe it isn't with the
ahk-while
, but perhaps a way to just hold down a key?– fohrums
Nov 4 at 13:04
add a comment |
up vote
2
down vote
Try also the remapping:
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
Replace Title of my game
with the exact title of the game window as shown in Window Spy.
https://autohotkey.com/docs/commands/_IfWinActive.htm
EDIT:
You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys for more than one applications/windows:
#If WinActive("Title of my game1") || WinActive("Title of my game2") ; "||" means "OR"
XButton1::w
XButton2::x
#If WinActive("Title of my game3")
XButton1::a
XButton2::b
#If ; turn off context sensitivity
; In all other applications/windows you can make XButton1 and XButton2 to do something else, e.g.:
XButton1:: Send ^c ; copy
XButton2:: Send ^v ; paste
https://autohotkey.com/docs/commands/_If.htm
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each(gametitle)
. So the lines w/ the poundsign is needed including the last line#ifwinactive
?
– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
add a comment |
up vote
2
down vote
Try also the remapping:
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
Replace Title of my game
with the exact title of the game window as shown in Window Spy.
https://autohotkey.com/docs/commands/_IfWinActive.htm
EDIT:
You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys for more than one applications/windows:
#If WinActive("Title of my game1") || WinActive("Title of my game2") ; "||" means "OR"
XButton1::w
XButton2::x
#If WinActive("Title of my game3")
XButton1::a
XButton2::b
#If ; turn off context sensitivity
; In all other applications/windows you can make XButton1 and XButton2 to do something else, e.g.:
XButton1:: Send ^c ; copy
XButton2:: Send ^v ; paste
https://autohotkey.com/docs/commands/_If.htm
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each(gametitle)
. So the lines w/ the poundsign is needed including the last line#ifwinactive
?
– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
add a comment |
up vote
2
down vote
up vote
2
down vote
Try also the remapping:
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
Replace Title of my game
with the exact title of the game window as shown in Window Spy.
https://autohotkey.com/docs/commands/_IfWinActive.htm
EDIT:
You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys for more than one applications/windows:
#If WinActive("Title of my game1") || WinActive("Title of my game2") ; "||" means "OR"
XButton1::w
XButton2::x
#If WinActive("Title of my game3")
XButton1::a
XButton2::b
#If ; turn off context sensitivity
; In all other applications/windows you can make XButton1 and XButton2 to do something else, e.g.:
XButton1:: Send ^c ; copy
XButton2:: Send ^v ; paste
https://autohotkey.com/docs/commands/_If.htm
Try also the remapping:
#NoEnv
#SingleInstance Force
#InstallKeybdHook
#InstallMouseHook
#UseHook
#IfWinActive Title of my game
XButton1::w
#IfWinActive
Replace Title of my game
with the exact title of the game window as shown in Window Spy.
https://autohotkey.com/docs/commands/_IfWinActive.htm
EDIT:
You can use the #If- or the #IfWinActive- directive to create context-sensitive hotkeys for more than one applications/windows:
#If WinActive("Title of my game1") || WinActive("Title of my game2") ; "||" means "OR"
XButton1::w
XButton2::x
#If WinActive("Title of my game3")
XButton1::a
XButton2::b
#If ; turn off context sensitivity
; In all other applications/windows you can make XButton1 and XButton2 to do something else, e.g.:
XButton1:: Send ^c ; copy
XButton2:: Send ^v ; paste
https://autohotkey.com/docs/commands/_If.htm
edited Nov 6 at 13:13
answered Nov 4 at 13:32
user3419297
1,636257
1,636257
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each(gametitle)
. So the lines w/ the poundsign is needed including the last line#ifwinactive
?
– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
add a comment |
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each(gametitle)
. So the lines w/ the poundsign is needed including the last line#ifwinactive
?
– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each
(gametitle)
. So the lines w/ the poundsign is needed including the last line #ifwinactive
?– fohrums
Nov 6 at 12:35
This works, but I wanted to avoid having to implement the title of game and create multiple same code for each
(gametitle)
. So the lines w/ the poundsign is needed including the last line #ifwinactive
?– fohrums
Nov 6 at 12:35
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
See EDIT in my answer.
– user3419297
Nov 6 at 13:06
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1372164%2fautohotkeyahk-holding-a-mouse-button-to-hold-another-key%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Unclear what are your problem and solution.
– harrymc
Nov 2 at 13:27
Problem is that the suggested answer by @user3419297, gets the job done by actually holding w, but it's too fast and not properly replicating how window's holds down a key.
– fohrums
Nov 3 at 12:28