Astreisk not working and modifiers reset Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Scripperfeels7
Posts: 6
Joined: 26 Mar 2023, 07:31

Astreisk not working and modifiers reset

Post by Scripperfeels7 » 31 Mar 2023, 14:08

To my understanding * is supposed to ignore modifiers? This doesn't seem to work for me. So for example the following script works, but if I press shift or ctrl during it, it doesn't.

Code: Select all

3::
While (A_ThisHotkey = 3) And (A_Index <= 10)
{
	Send 8
	Sleep 50
}
Return
Now if I put a "*3::" as the bind instead, nothing happens when I tap 3. If however I do a double bind like so:

Code: Select all

3::
+3::
While (A_ThisHotkey = 3) And (A_Index <= 10)
{
	Send 8
	Sleep 50
}
Return
Then shift / ctrl are released instead of being held down as I tap 3.

What's going on with the asterisk, and how do I make AHK keep the modifiers pressed without interrupting them, while still activating the hotkey script?

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

Re: Astreisk not working and modifiers reset  Topic is solved

Post by mikeyww » 31 Mar 2023, 17:23

Code: Select all

#Requires AutoHotkey v1.1.33
*3::
SetKeyDelay 50
While GetKeyState(3, "P") && A_Index < 11 {
 Send {Blind}8
 ToolTip % A_Index
}
KeyWait 3
ToolTip
Return
The secret to writing this script is understanding the values of your variables. You can use the script itself to do that-- display the values for you-- or use one of the debugging tools.

Scripperfeels7
Posts: 6
Joined: 26 Mar 2023, 07:31

Re: Astreisk not working and modifiers reset

Post by Scripperfeels7 » 02 Apr 2023, 19:03

mikeyww wrote:
31 Mar 2023, 17:23

Code: Select all

#Requires AutoHotkey v1.1.33
*3::
SetKeyDelay 50
While GetKeyState(3, "P") && A_Index < 11 {
 Send {Blind}8
 ToolTip % A_Index
}
KeyWait 3
ToolTip
Return
The secret to writing this script is understanding the values of your variables. You can use the script itself to do that-- display the values for you-- or use one of the debugging tools.
Good idea, it's just hard to see whether shift is pressed or not in the script and I have no knowledge or experience of using any AHK debugging tools! Tbh so far I've just used it for menial simple tasks so I didn't need one. I guess I should get one tho. :D

But despite having AHK 1.1.33.10, the asterisk isn't working at all. Also {Blind} sends a shift-modified 8 instead of an actual 8. But it appears the case I need it for already accounts for modifiers so that's not a problem. How would I keep the shift pressed while still sending a regular 8 though, for future reference?

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

Re: Astreisk not working and modifiers reset

Post by mikeyww » 02 Apr 2023, 20:09

It looks to me like it works, but you must have a different idea. In the presence of the wildcard hotkey modifier (*), the hotkey can be triggered with or without the modifiers. If you want the 8 to be sent without their effect, you can remove {Blind}.

If you are holding a modifier, AHK will automatically release it to send the 8, because otherwise the 8 cannot be sent, right? It isn't magic. It's just like you would send an 8 yourself-- without any modifiers.

Scripperfeels7
Posts: 6
Joined: 26 Mar 2023, 07:31

Re: Astreisk not working and modifiers reset

Post by Scripperfeels7 » 03 Apr 2023, 11:56

Yeah that's a fair point. Didn't hurt to ask tho! And also yeah I have no idea why the asterisk isn't working, but I'll cross that bridge when I need to. Thanks again!

Post Reply

Return to “Ask for Help (v1)”