Page 1 of 1

Simple remap script consultation

Posted: 08 May 2024, 09:53
by Hermitianc
Hello, for context: I am playing an organ vst using my pc keyboard and I need autohotkey to play an octave using Space.

I am trying to do the script for the following remap:
I press space, autohotkey sends it to quick succession of Ctrl + Shift + w + x,
and if I hold space it holds w+x.

Just to illustrate:

Space ----> Ctrl, Shift, w, x
If I hold Space it continues to hold w and x only, releasing Shift and Ctrl.

My attempt:

Code: Select all

Space:: 
	Send, {Ctrl down}{Shift down}{w down}
	sleep 10
	Send,{x down}
	KeyWait, Space
	Send, {Ctrl up}{Shift up}{w up}{x up}
return
It doesn't work as I intended. Thanks for any help in advance.

[Mod edit: Moved topic from AHK v2 help since this is v1 code.]

Re: Simple remap script consultation

Posted: 08 May 2024, 11:15
by Rohwedder
Hallo,
according to your requirement, it should work like this:

Code: Select all

Space:: 
	Send, {Ctrl down}{Shift down}{w down}
	sleep 30
	Send, {Blind}{x down}
	sleep 30
	Send, {Ctrl up}{Shift up} ; hold w and x only, releasing Shift and Ctrl
	KeyWait, Space
	Send, {w up}{x up}
return