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..
![Sad :(](./images/smilies/icon_e_sad.gif)
I have windows 10 x64
Any solution?
Thanks
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
}
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.
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
}
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
}
Its workingNoesis 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 }
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.
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%
}
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"
]
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