Hello!
I'm trying to get rid of those icons on the notification area that still showing if you kill a proccess, tried several scripts i've found on the old forums but none worked for me..
I have windows 10 x64
Any solution?
Thanks
Refresh System tray Icons Topic is solved
Re: Refresh System tray Icons
Try
Replace "ToolbarWindow321" with "ToolbarWindow3211" if you have Windows 10.
Code: Select all
WM_MOUSEMOVE := 0x200
ControlGetPos, xTray,, wTray,, ToolbarWindow321, ahk_class Shell_TrayWnd
endX := xTray + wTray
x := 5
y := 12
Loop
{
if (x > endX)
break
point1 := (y << 16) + x
point2 := (x << 16) + y ; If the notification area has two rows
point3 := (x << 16) + 5*y/2 ; If the notification area has three rows
PostMessage, %WM_MOUSEMOVE%, 0, %point1%, ToolbarWindow321, ahk_class Shell_TrayWnd
PostMessage, %WM_MOUSEMOVE%, 0, %point2%, ToolbarWindow321, ahk_class Shell_TrayWnd
PostMessage, %WM_MOUSEMOVE%, 0, %point3%, ToolbarWindow321, ahk_class Shell_TrayWnd
x += 18
}
Re: Refresh System tray Icons
Not working tried with ToolbarWindow321 and ToolbarWindow3211
Re: Refresh System tray Icons
After closing or killing a prozess you should use "Process, WaitClose" or add a sleep to your script before refreshing the notification area.
Re: Refresh System tray Icons
GEV wrote:After closing or killing a prozess you should use "Process, WaitClose" or add a sleep to your script before refreshing the notification area.
Not working neither
Using
Code: Select all
Process, Close, LErt.exe
Sleep 10000
WM_MOUSEMOVE := 0x200
ControlGetPos, xTray,, wTray,, ToolbarWindow321, ahk_class Shell_TrayWnd
endX := xTray + wTray
x := 5
y := 12
Loop
{
if (x > endX)
break
point1 := (y << 16) + x
point2 := (x << 16) + y ; If the notification area has two rows
point3 := (x << 16) + 5*y/2 ; If the notification area has three rows
PostMessage, %WM_MOUSEMOVE%, 0, %point1%, ToolbarWindow321, ahk_class Shell_TrayWnd
PostMessage, %WM_MOUSEMOVE%, 0, %point2%, ToolbarWindow321, ahk_class Shell_TrayWnd
PostMessage, %WM_MOUSEMOVE%, 0, %point3%, ToolbarWindow321, ahk_class Shell_TrayWnd
x += 18
}
Re: Refresh System tray Icons Topic is solved
I use the following function, which works for me on win 10:
GEV's should work too but I suspect he's on win 7 and hence gave the wrong control class (should be ToolbarWindow322).
Code: Select all
Tray_Refresh()
{
WM_MOUSEMOVE := 0x200
HiddenWindows := A_DetectHiddenWindows
DetectHiddenWindows, On
TrayTitle := "AHK_class Shell_TrayWnd"
ControlNN := "ToolbarWindow322"
IcSz := 24
Loop, 2
{
ControlGetPos, xTray,yTray,wdTray,htTray, %ControlNN%, %TrayTitle%
y := htTray - 10
While (y > 0)
{
x := wdTray - IcSz/2
While (x > 0)
{
point := (y << 16) + x
PostMessage, %WM_MOUSEMOVE%, 0, %point%, %ControlNN%, %TrayTitle%
x -= IcSz/2
}
y -= IcSz/2
}
TrayTitle := "AHK_class NotifyIconOverflowWindow"
ControlNN := "ToolbarWindow321"
IcSz := 32
}
DetectHiddenWindows, %HiddenWindows%
Return
}
Re: Refresh System tray Icons
Try Noesis's approach. Works for me too (on Win10). Thanks for sharing, Noesis!
Re: Refresh System tray Icons
I tried Noesis' script but can't get it to work for me.
I'm on Win 7x64 Home Premium OEM. I'm using the ToolbarWindow322 value. I tried it with 321.
When I run Noesis's script, it's not giving an error; appears to run ok but a deleted AHK process icon remains in my Tray (unless I clear it manually with the mouse).
My issue may be that I'm still running an old AHK version, Version v1.0.95.00 . I haven't upgraded since all of my scripts are running great; never an issue so that's made me hesitant to upgrade AHK.
Could that be the reason that Noesis's script doesn't work for me?
I'm on Win 7x64 Home Premium OEM. I'm using the ToolbarWindow322 value. I tried it with 321.
When I run Noesis's script, it's not giving an error; appears to run ok but a deleted AHK process icon remains in my Tray (unless I clear it manually with the mouse).
My issue may be that I'm still running an old AHK version, Version v1.0.95.00 . I haven't upgraded since all of my scripts are running great; never an issue so that's made me hesitant to upgrade AHK.
Could that be the reason that Noesis's script doesn't work for me?
Re: Refresh System tray Icons
Its working But only If assign it a Hotkey, how I can make it work without the hotkey?Noesis wrote:I use the following function, which works for me on win 10:
GEV's should work too but I suspect he's on win 7 and hence gave the wrong control class (should be ToolbarWindow322).Code: Select all
Tray_Refresh() { WM_MOUSEMOVE := 0x200 HiddenWindows := A_DetectHiddenWindows DetectHiddenWindows, On TrayTitle := "AHK_class Shell_TrayWnd" ControlNN := "ToolbarWindow322" IcSz := 24 Loop, 2 { ControlGetPos, xTray,yTray,wdTray,htTray, %ControlNN%, %TrayTitle% y := htTray - 10 While (y > 0) { x := wdTray - IcSz/2 While (x > 0) { point := (y << 16) + x PostMessage, %WM_MOUSEMOVE%, 0, %point%, %ControlNN%, %TrayTitle% x -= IcSz/2 } y -= IcSz/2 } TrayTitle := "AHK_class NotifyIconOverflowWindow" ControlNN := "ToolbarWindow321" IcSz := 32 } DetectHiddenWindows, %HiddenWindows% Return }
Because if I just paste that code into an .ahk and run it, does nothing :/
Re: Refresh System tray Icons
Put Tray_Refresh() somewhere in your code to call the function.
Re: Refresh System tray Icons
Scoop8 I used to use this exact script in Win7 (home premium x64 OEM as well) and it should work provided you use ToolbarWindow321 for the controlNN.
It's possible it's the AHK version, personally I've never had an issue upgrading ahk to latest versions with regard to script backwards compatibility and would recommend you upgrade to latest version of AHK regardless of this being the cause of this issue.
Also It's possible the ahk icon not being cleared is from the instance running this function (i.e. it's active until the function finishes), in which case call it from a script which uses #Notrayicon. Personally I don't do this as my ahk icons all self clear upon script completion anyway, but something to try perhaps.
It's possible it's the AHK version, personally I've never had an issue upgrading ahk to latest versions with regard to script backwards compatibility and would recommend you upgrade to latest version of AHK regardless of this being the cause of this issue.
Also It's possible the ahk icon not being cleared is from the instance running this function (i.e. it's active until the function finishes), in which case call it from a script which uses #Notrayicon. Personally I don't do this as my ahk icons all self clear upon script completion anyway, but something to try perhaps.
Re: Refresh System tray Icons
Thanks!
Its working with Noesis Script!
Its working with Noesis Script!
Re: Refresh System tray Icons
Thanks for the info. I need to upgrade to the latest version, just haven't done it yet. I'll get that done this weekend.Noesis wrote:Scoop8 I used to use this exact script in Win7 (home premium x64 OEM as well) and it should work provided you use ToolbarWindow321 for the controlNN.
It's possible it's the AHK version, personally I've never had an issue upgrading ahk to latest versions with regard to script backwards compatibility and would recommend you upgrade to latest version of AHK regardless of this being the cause of this issue.
Also It's possible the ahk icon not being cleared is from the instance running this function (i.e. it's active until the function finishes), in which case call it from a script which uses #Notrayicon. Personally I don't do this as my ahk icons all self clear upon script completion anyway, but something to try perhaps.
I tried the script using -> ControlNN := "ToolbarWindow321" but it didn't work for me. I tested the script this way:
- Run one of my ahk scripts, a "reminder" script that I use all the time when I'm on my PC.
- Deleted the ahk script using "Process Explorer".
- Checked Sys Tray; verified the deleted process orphaned Icon was present as expected.
- Ran the above script in this thread, using the "321" value in both lines of the script for the 'controlNN' variable.
I didn't work for me as the orphaned Icon remained in the Tray after running the script.
I found a standalone exe file online that refreshes the Tray and removes orphaned Icons so my issue is fixed using another method.
I want to get the ahk script to work as I like to learn from this forum and use ahk for such tasks but I'm a novice compared to just about everyone else here so it takes me a while to grasp some things here. (if you all saw my 'Reminder.ahk' script, you'd at it , but it works for me.)
Thanks for the reply
Re: Refresh System tray Icons
Do you mind sharing what program that was?
Re: Refresh System tray Icons
Or does it work with W10 for anyone? because the script above in an AHK alone does nothing for me, Ambibox is still there.
Re: Refresh System tray Icons
Soo, having upgraded to W10 recently, I noticed this doesn't work anymore.
Here's the version I came-up with:
And in case someone'd like to test it out:
Here's the version I came-up with:
Code: Select all
Tray_Refresh()
Tray_Refresh() {
/* Remove any dead icon from the tray menu
* Should work both for W7 & W10
*/
WM_MOUSEMOVE := 0x200
detectHiddenWin := A_DetectHiddenWindows
DetectHiddenWindows, On
allTitles := ["ahk_class Shell_TrayWnd"
, "ahk_class NotifyIconOverflowWindow"]
allControls := ["ToolbarWindow321"
,"ToolbarWindow322"
,"ToolbarWindow323"
,"ToolbarWindow324"]
allIconSizes := [24,32]
for id, title in allTitles {
for id, controlName in allControls
{
for id, iconSize in allIconSizes
{
ControlGetPos, xTray,yTray,wdTray,htTray,% controlName,% title
y := htTray - 10
While (y > 0)
{
x := wdTray - iconSize/2
While (x > 0)
{
point := (y << 16) + x
PostMessage,% WM_MOUSEMOVE, 0,% point,% controlName,% title
x -= iconSize/2
}
y -= iconSize/2
}
}
}
}
DetectHiddenWindows, %detectHiddenWin%
}
Code: Select all
#SingleInstance, Off
#Persistent
Loop, %0% { ; Command-Line Parameters
param := %A_Index%
if (param="/Secondary")
isSecondary := true
}
if !(isSecondary) {
AHK_PIDS := {}
Progress, , ,Running multiple process of the script,Tray_Refresh
Loop 5 { ; Running instances
Progress,% (100/5) * A_Index
Run,% A_ScriptFullPath " /Secondary", , ,scriptPID
AHK_PIDS.Push(scriptPID)
Sleep 10
}
Progress, Off
for id, pid in AHK_PIDS { ; Closing instances
Process, Close,% pid
}
Sleep 100
MsgBox, 4096,Tray_Refresh,% "Close this box to remove all dead icons from the tray."
Tray_Refresh()
ExitApp
}
Return
Tray_Refresh() {
/* Remove any dead icon from the tray menu
* Should work both for W7 & W10
*/
WM_MOUSEMOVE := 0x200
detectHiddenWin := A_DetectHiddenWindows
DetectHiddenWindows, On
allTitles := ["ahk_class Shell_TrayWnd"
, "ahk_class NotifyIconOverflowWindow"]
allControls := ["ToolbarWindow321"
,"ToolbarWindow322"
,"ToolbarWindow323"
,"ToolbarWindow324"]
allIconSizes := [24,32]
for id, title in allTitles {
for id, controlName in allControls
{
for id, iconSize in allIconSizes
{
ControlGetPos, xTray,yTray,wdTray,htTray,% controlName,% title
y := htTray - 10
While (y > 0)
{
x := wdTray - iconSize/2
While (x > 0)
{
point := (y << 16) + x
PostMessage,% WM_MOUSEMOVE, 0,% point,% controlName,% title
x -= iconSize/2
}
y -= iconSize/2
}
}
}
}
DetectHiddenWindows, %detectHiddenWin%
}
Re: Refresh System tray Icons
@masato : Work great on windows 10, thx !
Re: Refresh System tray Icons
Thank you for the script. It worked for me in Win10 after I modified this linemasato wrote:Soo, having upgraded to W10 recently, I noticed this doesn't work anymore.
Here's the version I came-up with
Code: Select all
allControls := ["ToolbarWindow321"
,"ToolbarWindow322"
,"ToolbarWindow323"
,"ToolbarWindow324"]
Code: Select all
allControls := ["ToolbarWindow321"
,"ToolbarWindow322"
,"ToolbarWindow323"
,"ToolbarWindow324"
,"ToolbarWindow325"
,"ToolbarWindow326"
]
Re: Refresh System tray Icons
Doesn't do anything to tray , at least regarding remaining AHK script icon. (win10)Selukwe wrote: ↑23 Apr 2017, 03:53Try this freeware: SystemTrayRefresh. Will do the job without any programming. Find at http://visualfantasy.tk
As for script solution above, it works. But system specific, which doesn't work for me. Need it to be system free, aka to work on any windows 7-10
- Cr8zy_Ivan
- Posts: 131
- Joined: 30 Mar 2019, 18:20
Re: Refresh System tray Icons
@masato (& @Noesis for initial script), Thank you! The script works perfectly!
Who is online
Users browsing this forum: peter_ahk and 147 guests