Page 1 of 1
GetKeyState functionality not working Version 1.1.30.03
Posted: 28 Sep 2019, 18:58
by GusNoFear-
I've spend so many hours today finding out how getkeystate() works. I've finished writing the following piece of code to simulate Ctrl + Shift + {right or left}.
Code: Select all
#If GetKeyState("Alt", "P")
~Capslock & [::
SendInput, +^{Left}
Sleep, 50
Return
~Capslock & ]::
SendInput, +^{Right}
Sleep, 50
Return
#If
The goal of this script would be to highlight the upcoming or preceding words in a text editor. My code highlights the upcoming words but not the preceding words. Any helpful tips are greatly appreciated.
Re: GetKeyState functionality not working Version 1.1.30.03
Posted: 28 Sep 2019, 19:19
by jeeswg
This worked for me:
Code: Select all
#If GetKeyState("Alt", "P") && GetKeyState("CapsLock", "P")
;~Capslock & [::
*[::
SendInput, +^{Left}
Sleep, 50
Return
;~Capslock & ]::
*]::
SendInput, +^{Right}
Sleep, 50
Return
#If
Re: GetKeyState functionality not working Version 1.1.30.03
Posted: 28 Sep 2019, 19:21
by submeg
I just grabbed your code and added it to a blank ahk file; running it by itself, the code works as you explained.
Do you have any other codes that could be conflicting?
Re: GetKeyState functionality not working Version 1.1.30.03
Posted: 28 Sep 2019, 19:29
by GusNoFear-
This code doesn't do anything on my end. I think it's something with my computer because the getkeystate doesn't always work. I've tried it in other keys.
Re: GetKeyState functionality not working Version 1.1.30.03
Posted: 28 Sep 2019, 19:52
by lexikos
You should update to v1.1.31.00. I don't think I've fixed anything specifically relating to your issue, but there were a bunch of bug fixes relating to hotkeys.