possible bug: {appskey} loses keyboard focus?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gilbenherut
Posts: 4
Joined: 28 Jun 2022, 12:47
Contact:

possible bug: {appskey} loses keyboard focus?

Post by gilbenherut » 28 Jun 2022, 12:57

Hi,

I am new to this community and hope I am posting in the right location. I am a big fan of AHK, but am stuck with this issue:

The following script is meant to exit a program that appears as an icon in the taskbar (access through Win+b):
```

Code: Select all

!b::
  send #b
  send {right}
  send {AppsKey};
  send {up}
  send {enter}
Return
```

It's a bit hacky, but the idea is to open the context-menu using the `{AppsKey}` mapping and then choose the last item on the pop-up menu (which is "Exit") and hit enter. The problem is that send {AppsKey} does *not* behave exactly like the context-menu key, because it loses the keyboard focus (the next commnd, `send {up}` does nothing. When I try to do this "manually" (that is, pressing Win+b, then right arrow, then context-menu button) -- the focus remains and the next command -- arrow up -- works fine.

Thanks in advance for any help.
Gil
Last edited by gregster on 28 Jun 2022, 12:58, edited 1 time in total.
Reason: Topic moved from 'Bug Reports'.

User avatar
Xtra
Posts: 2744
Joined: 02 Oct 2015, 12:15

Re: possible bug: {appskey} loses keyboard focus?

Post by Xtra » 28 Jun 2022, 13:29

send {AppsKey};

You are also sending a semicolon is that intended?

gilbenherut
Posts: 4
Joined: 28 Jun 2022, 12:47
Contact:

Re: possible bug: {appskey} loses keyboard focus?

Post by gilbenherut » 04 Jul 2022, 17:37

Thanks.

The semicolon is a residue of an experiment. Please ignore: even without semicolon, the problem persists.

(BTW: how do I get an email notice when this thread is updated? I did not get it ....)

gilbenherut
Posts: 4
Joined: 28 Jun 2022, 12:47
Contact:

Re: possible bug: {appskey} loses keyboard focus?

Post by gilbenherut » 04 Jul 2022, 17:39

Okay, I "manually" subscribed to the topic ...

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

Re: possible bug: {appskey} loses keyboard focus?

Post by mikeyww » 04 Jul 2022, 18:05

Some things to try:

1. Key-UP hotkey
2. Add some Sleep

gilbenherut
Posts: 4
Joined: 28 Jun 2022, 12:47
Contact:

Re: possible bug: {appskey} loses keyboard focus?

Post by gilbenherut » 04 Jul 2022, 19:05

Ha!

Adding:
```
sleep 200
```
-- before the {AppsKey} command did the trick.

Thanks a lot!

Post Reply

Return to “Ask for Help (v1)”