I need help with starting a script on RightArrowPress

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rightarrowguy
Posts: 3
Joined: 03 Oct 2022, 13:41

I need help with starting a script on RightArrowPress

Post by rightarrowguy » 03 Oct 2022, 13:48

hi
my Bluetooth keyboard is messed up and when I press the RightArrowKey it presses RightArrowKey + / (I am not sure if it presses them at the same time or not, what I know is that some times it presses RightArrowKey before '/' and sometimes after)
I need to make a script that fixes this.
I am not new to AHK , but treat me as a noob , since the only thing that I know is :

Code: Select all

:r*:vc:: VARCHAR,
return
so I decided to make something like this

Code: Select all

:r*:{Right}\:: {Right},
return
:r*:/{Right}:: {Right},
return
but it does not work
can someone help me?

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I need help with starting a script on RightArrowPress

Post by mikeyww » 03 Oct 2022, 14:29

Welcome to this AutoHotkey forum!

Code: Select all

~Right::Send % A_PriorKey = "/" ? "{Left}`b{Right}" : ""
~/::Send % A_PriorKey = "Right" ? "`b" : ""

rightarrowguy
Posts: 3
Joined: 03 Oct 2022, 13:41

Re: I need help with starting a script on RightArrowPress

Post by rightarrowguy » 03 Oct 2022, 16:18

mikeyww wrote:
03 Oct 2022, 14:29
Welcome to this AutoHotkey forum!

Code: Select all

~Right::Send % A_PriorKey = "/" ? "{Left}`b{Right}" : ""
~/::Send % A_PriorKey = "Right" ? "`b" : ""
Hi :)
so there is a problem with this script , it works like 5% of the times , I think that there is no solution to this problem , I will have to use right shift as right arrow :(
anyhow, thanx for your help :)
btw, now that I think about it, is there a way to simulate a virtual keyboard that detects if the RightArrowKey and / have been pressed less than 200ms from each other ? if so, it returns only RightArrowKey

User avatar
mikeyww
Posts: 26437
Joined: 09 Sep 2014, 18:38

Re: I need help with starting a script on RightArrowPress

Post by mikeyww » 03 Oct 2022, 19:59

Code: Select all

~Right::r := A_TickCount
$/::
If !r || A_TickCount - r > 200 {
 Input, key, L1T.2, % "{LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}"
                    . "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}"
                    . "{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}"
                    . "{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}"
 Send % ErrorLevel = "EndKey:Right" ? "{Right}"
      : "/{" (key > "" ? GetKeyName(key) : StrReplace(ErrorLevel, "EndKey:")) "}"
}
Return

rightarrowguy
Posts: 3
Joined: 03 Oct 2022, 13:41

Re: I need help with starting a script on RightArrowPress

Post by rightarrowguy » 04 Oct 2022, 05:44

mikeyww wrote:
03 Oct 2022, 19:59

Code: Select all

~Right::r := A_TickCount
$/::
If !r || A_TickCount - r > 200 {
 Input, key, L1T.2, % "{LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}"
                    . "{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}"
                    . "{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}"
                    . "{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}"
 Send % ErrorLevel = "EndKey:Right" ? "{Right}"
      : "/{" (key > "" ? GetKeyName(key) : StrReplace(ErrorLevel, "EndKey:")) "}"
}
Return
hey , thanx OG, it works like a charm
you saved me 30$
:)

Post Reply

Return to “Ask for Help (v1)”