Sign in to follow this  
Followers 0
staples

system tray script

6 posts in this topic

I want to find the pixel location (since it can vary) and mouse over it to remove my icon that remains after I kill a task.

Does anyone know how to find the location of windows xp system tray?

Is there another way to refresh the system tray?

Share this post


Link to post
Share on other sites

Generally the tray can be in one of four locations, dependant on what side of the monitor the tray's been docked on. Why not just wave the mouse over these four areas in sequence?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This brute force method seems to work:

Func RefreshTray()
    $speed = 5
    $original = MouseGetPos()
    MouseMove (10,10)
    MouseMove (10,@DesktopHeight - 10, $speed)
    MouseMove (@DesktopWidth - 10,@DesktopHeight - 10, $speed)
    MouseMove (@DesktopWidth - 10,10, $speed)
    MouseMove (10,10, $speed)
    MouseMove ($original[0],$original[1])
EndFunc
Edited by weaponx

Share this post


Link to post
Share on other sites

That works. I added some speed to it.

RefreshTray()

Func RefreshTray()
    $speed = 2
    $original = MouseGetPos()
    MouseMove(10,10,$speed)
    MouseMove(10,@DesktopHeight - 10, $speed)
    MouseMove(@DesktopWidth - 10,@DesktopHeight - 10, $speed)
    MouseMove(@DesktopWidth - 10,10, $speed)
    MouseMove(10,10, $speed)
    MouseMove($original[0],$original[1],$speed)
EndFunc

Share this post


Link to post
Share on other sites

When I made the speed any faster, some icons that needed to disappear stayed behind. But varying resolutions could effect this.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Generally the tray can be in one of four locations....

Beyond what Blue_Drache and weaponx have offered, this does what you were asking / looking for. I put this together after not being able to find a registry key that provided the taskbar location. Hope this helps you and others out.

Opt("WinTitleMatchMode", 4)

$aTray = WinGetPos("[Class:Shell_TrayWnd]")

If ($aTray[0] == 0) And ($aTray[2] == @DesktopWidth) Then
    If ($aTray[1] == 0) Then 
        MsgBox(0, "", "Taskbar is on Top")
    Else
        MsgBox(0, "", "Taskbar is on Bottom")
    EndIf
EndIf

If ($aTray[1] == 0) And ($aTray[3] == @DesktopHeight) Then
    If ($aTray[0] == 0) Then
        MsgBox(0, "", "Taskbar is to the Left")
    Else
        MsgBox(0, "", "Taskbar is to the Right")
    EndIf
EndIf

On a related note, anyone know how to get the coord of a particular icon in the systray without using PixelSearch()? Thanks in advance!

========

Edit: After a little more searching I found this UDF that give me what I was after. Others looking for scripts that control the systray should look at this link for Systray UDF.

Edited by ssubirias3

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0