Some Windows embedded shortcuts not working in script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Some Windows embedded shortcuts not working in script

Post by CuriousDad » 27 Mar 2023, 21:53

There are certain shortcuts embedded in Windows that aren't working for me and I'm figuring that I'm doing something wrong.

I'm trying to use a Windows shortcut:

Send #b

to select a running program in the program tray. It won't run as is or with brackets. {Lwin}b doesn't work either. I noticed that #d doesn't work either.

Many of the other Windows shortcut works such as ^c, ^v. Are the ones with the Windows key locked out or is there another way to enter the value for a hotkey?

Thank you.

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

Re: Some Windows embedded shortcuts not working in script

Post by mikeyww » 28 Mar 2023, 05:49

Hello,

This worked here.

Code: Select all

#Requires AutoHotkey v1.1.33
F3::
SetKeyDelay 25, 25
Send #b`n
Return

CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Re: Some Windows embedded shortcuts not working in script

Post by CuriousDad » 28 Mar 2023, 08:59

Thank you.

How would one know to use the SetKeyDelay for this purpose? Further, upon reading about SetKeyDelay, the instructions read:

SetKeyDelay [, Delay, PressDuration, Play]

What happened for the first comma? I think I understand Delay and PressDuration. What is Play? Does the delay stay throughout the script or just for the line after?

I understand what ` n did. What is this called?

Sorry for all these questions, but I would not have been able to figure this out on my own and I would like to try to learn. I am not a programmer so many of these tools are not so intuitive to me. Thanks for all the help.

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

Re: Some Windows embedded shortcuts not working in script

Post by mikeyww » 28 Mar 2023, 09:35

Good questions. The script might work without the delay. I just thought that it might be more reliable if the delay is there. One knows through testing scripts!

You can add the initial comma if you like. It can often be omitted, especially if the first command parameter is present (and it usually is present).

You can read about SendPlay in the documentation. I never use it as a send mode, but it works in some situations.

When a SetKeyDelay is executed within a thread such as this subroutine, it applies only to that thread.

I don't know what `n is called, but it is a line feed and often accomplishes something equivalent to {Enter}, though it's not exactly the same.

Most of what I wrote is already written in the documentation. I recommend referring to it when questions come up, but please feel free to post more issues or questions, too.

CuriousDad
Posts: 74
Joined: 21 Mar 2023, 11:23

Re: Some Windows embedded shortcuts not working in script

Post by CuriousDad » 28 Mar 2023, 11:30

Very kind and very helpful. Thanks.

Post Reply

Return to “Ask for Help (v1)”