Forcing Systray to Refresh

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Forcing Systray to Refresh

Post by kpassaur » Sun Apr 19, 2009 6:26 pm

This may sound silly, but after opening and closing a bunch of compiled Marcros, on occasion they stack up in the SysTray. No big deal really as when you place your mouse over them the screen redraws and they are gone.

However, I was wondering if there is a way to force the redraw so they would not do this.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Refresh System Tray of Dead icons

Post by adroege » Thu May 06, 2010 12:51 pm

I looked for some way in WMI or VBScript to do this but
couldn't find it (Yet, anyway)

However, this seems to work for me in XP and Windows Server 2008
It just moves the mouse over this area quickly, which forces Windows to redraw and remove any old icons left over from "dead" programs.

Code: Select all

GetCursorPos>OLD_X,OLD_Y
GetWindowPos>Notification Area*,X,Y
GetScreenRes>MAX_X,MAX_Y
Let>MAX_X=MAX_X-10
Let>Y=Y+8
MouseMove>X,Y
Label>Loop
  If>X>MAX_X,Loop_x
    Add>X,8
    MouseMove>X,Y
  Endif
  Goto>Loop
Label>Loop_x
MouseMove>OLD_X,OLD_Y

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Never thought of that

Post by kpassaur » Thu May 06, 2010 12:55 pm

Thanks I would never have thought of that.

wil
Junior Coder
Posts: 25
Joined: Mon Dec 06, 2010 6:00 pm

Post by wil » Thu Jun 21, 2012 11:07 pm

Hi

In windows7 i use this code to kill spotify (it won't close normally by itself and GetWindowPos>Notification Area* doesn't work under windows7) AND to get rid of the stack up icons in the tray.
For some reason code was not displayed correctly here so i uploaded the code to another location.

Disadvantage: it only works when systray is at the bottom of the screen. So if there is any better solution, please let me know.

best regards,
wil

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts