Page 1 of 1

How can I use SC or VK with Keywait?

Posted: 25 Feb 2018, 10:19
by vsub
If it is possible
The key I am trying to press is the Fn key(SC075\VKFF)but Keywait is ignoring in no matter what I try.

I want to trigger the ^!{Tab} ;Ctrl+Alt+Tab
when I press and release the key in less than a second but keywait is directly setting errorlevel to 1
I tried with this but it's not working

Code: Select all

~SC075::
Keywait,% SubStr(A_ThisHotkey,2),T1 
If ErrorLevel = 0
Send ^!{Tab}
Return
Acourding to the console,when I press the key,it spam it every 0.03 seconds and it only send one up state with 0.01 as time when I release the key

Code: Select all

FF  075	h	d	0.05	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.05	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	h	d	0.03	not found      	
FF  075	 	u	0.01	not found

Re: How can I use SC or VK with Keywait?

Posted: 25 Feb 2018, 12:18
by Exaskryz
Considering it's the Fn key, which doesn't usually play nicely with AHK, you may be out of luck. Check with using a different key value. For me, the ` key is vkC0sc029; you can try using a hotkey of ~SC029:: or whichever value matches some other key you want to test on. This'll make sure you're doing things right to trigger the hotkey. (It may also be useful for testing purposes to change your Send into a MsgBox.)

Re: How can I use SC or VK with Keywait?

Posted: 25 Feb 2018, 13:51
by vsub
If I remove the "If" condition or set it to 1,then the command is executed.

Re: How can I use SC or VK with Keywait?

Posted: 25 Feb 2018, 16:16
by Exaskryz
I would expect that. The KeyWait is still timing out, but whenever you've tested it the ErrorLevel has been set to 1.

To be clear, the code's intention is to execute Ctrl+Alt+Tab only when you press and release, all within 1 second, the Fn key.

The Fn key is notorious for not being something AHK can readily access, hence my suggestion to make sure your code is working with a more regular key.

Additionally, there's special handling of AltTab by AHK for Windows 8 and 10 (and maybe 7?). That's why I suggested the MsgBox, but since you're reporting the command is being executed, I don't think there's a problem with the command.