Jump to content

System Tray Icon Click


Recommended Posts

Hi,

I need to click (double-click) a system tray icon of specific program (not created by Autoit).

I have searched the whole forum for a solution, but didn't find any (none of the many suggested source codes really work).

The most relevant code I found was the following, but it also doesn't work:

#include<Systray.au3>
#include<Array.au3>

Global $title = "Volume"
Global $prcoess = "volume.exe"

;clickSysTrayByTitle($title, "right")
clickSysTrayByProcess($prcoess, "right")

Func clickSysTrayByTitle($winTitle, $click = "left", $times = 1)
    Local $a = _SysTrayIconTitles ()
    Local $p = MouseGetPos()
    For $i = 0 To UBound($a) - 1
        If $a[$i] = $winTitle Then
            $pos = _SysTrayIconPos($i)
            MouseClick($click, $pos[0], $pos[1], $times, 1)
            ExitLoop
        EndIf
    Next
    MouseMove($p[0], $p[1], 1)
EndFunc  ;==>clickSysTray

Func clickSysTrayByProcess($winProcess, $click = "left", $times = 1)
    Local $a =  _SysTrayIconProcesses()
   ;_ArrayDisplay($a, "")
    Local $p = MouseGetPos()
    For $i = 0 To UBound($a) - 1
        If $a[$i] = $winProcess Then
            $pos = _SysTrayIconPos($i)
            MouseClick($click, $pos[0], $pos[1], $times, 1)
            ExitLoop
        EndIf
    Next
    MouseMove($p[0], $p[1], 1)
EndFunc

Does anyone have any working example/any suggestion?

Do I miss anything?

Link to comment
Share on other sites

Hi,

I know those func :)

Try to change the systray.au3

Search and replace int_ptr with int*

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Thanks for the quick answer.

However, I have already fixed the source code (and therefore didn't even mention this problem), but the script does not seem to work...

weird ^_^ , I have tried the script once again just now and it works great...

Ignore my message (and thanks once again). :)

Edited by autoit_shai
Link to comment
Share on other sites

Hi,

show me your script so that I can try it myself.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...