hide a specific tray icon on demand

Get help with using AutoHotkey and its commands and hotkeys
dokimi
Posts: 1
Joined: 03 Dec 2020, 20:23

hide a specific tray icon on demand

Post by dokimi » 03 Dec 2020, 20:50

hello I want to hide the icon of a specific program on demand from the tray bar.
I found 2 programs that can make the job done but they need registration and unessecery for a simple task taskbar hide, PS Tray Factory.
After alot of search I found this library that has TrayIcon_Hide function but I really don't understand how it works and I cant make it work any help will be apriciated.
https://www.autohotkey.com/boards/viewtopic.php?f=6&t=1229
I want a solution similar to
TrayIcon_Hide ("ahk.exe")

User avatar
JoeWinograd
Posts: 1651
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: hide a specific tray icon on demand

Post by JoeWinograd » 03 Dec 2020, 22:50

This shows you how to do it. Incorporate it into your code however you want. Regards, Joe

Code: Select all

Program:="anyprog.exe"
WhichTray:=1 ; 0==>NotifyIconOverflowWindow (overflow tray)  1==>Shell_TrayWnd (main tray)
oIconInfo:=TrayIcon_GetInfo(Program)
ProgIDcmd:=oIconInfo[1].IDcmd
ProgTooltip:=oIconInfo[1].tooltip
TrayIcon_Hide(ProgIDcmd,WhichTray,True) ; this hides it
MsgBox,4160,Now Hidden,%ProgTooltip%
TrayIcon_Hide(ProgIDcmd,WhichTray,False) ; this shows it
MsgBox,4160,Now Shown,%ProgTooltip%
ExitApp
#Include TrayIconLibrary.ahk ; put your Include statement here

Post Reply

Return to “Ask For Help”