How to show a system tray. Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

How to show a system tray.

19 Sep 2021, 19:50

I use this following script to confirm the system tray.
But it hasn't worked for a few days.

Code: Select all

#Delete:: ;Show System Tray 
If (!WinExist("ahk_class NotifyIconOverflowWindow"))
{
   Send #b
   Send {Space}
}
else
   WinClose, ahk_class NotifyIconOverflowWindow
return


And I realized that pressing windows & b and spacebar show the system tray.
Can I show the system tray pressing just window & b, without spacebar?
I tried system tray setting. But I can't find the way.

How can i fix the issue?
Thanks for any help in advance.
Last edited by hancre on 19 Sep 2021, 19:56, edited 1 time in total.
User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: How to show a system tray.

19 Sep 2021, 19:53

It worked when I tried it.
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

Re: How to show a system tray.

19 Sep 2021, 20:00

mikeyww wrote:
19 Sep 2021, 19:53
It usually works.
If I can't fix the issue in my notebook, I'll use #b and spacebar, not the script.
Thank you for your help. ^^;
User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: How to show a system tray.  Topic is solved

19 Sep 2021, 20:09

I wonder if your script is part of a larger script.

Some debugging:

Code: Select all

#Delete::
MsgBox % WinExist("ahk_class NotifyIconOverflowWindow")
If WinExist("ahk_class NotifyIconOverflowWindow")
 WinClose
Else Send #b `
Return
Does the script work by itself, with no other code?
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

Re: How to show a system tray.

19 Sep 2021, 20:43

mikeyww wrote:
19 Sep 2021, 20:09
Your code works. ^^
What's ` in < Send #b `> ? ^^
I use it in a script starting at system startup. ( #NoTrayIcon )

I don't like the message box.
so I remove it. it works well, too.

Thank you for your help.
Last edited by hancre on 19 Sep 2021, 20:48, edited 1 time in total.
User avatar
mikeyww
Posts: 26889
Joined: 09 Sep 2014, 18:38

Re: How to show a system tray.

19 Sep 2021, 20:45

The script is the same as yours, just rearranged a bit. I also included the space after the #b. Your report suggests that something else in your script is interfering (i.e., a bug), or that your script never runs, or it exits prematurely. If you remove the #NoTrayIcon while you are debugging, it will improve your ability to verify that the script is running.

The backtick is a shorthand way of including a space at the end of a send. You can add a backtick after a trailing space to indicate that the trailing space should be included in the send. It is otherwise omitted. The backtick itself is not sent.

To eliminate the need to press the space bar:

Code: Select all

~#b::
If WinExist("ahk_class NotifyIconOverflowWindow")
 WinClose
Else Send {Space}
Return
hancre
Posts: 248
Joined: 02 Jul 2021, 20:51

Re: How to show a system tray.

19 Sep 2021, 20:57

mikeyww wrote:
19 Sep 2021, 20:45
Thanks again for your help.
I'm happy I learned the use of `.
It's useful for other case. ^^

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: wilkster and 344 guests