Sign in to follow this  
Followers 0
knightmare

right click icon in notification area (system tray)

8 posts in this topic

Hi I need to write an AutoIT script that right clicks the icon in the system tray/notification area and then clicks the "exit" option.

I tried this with the mouse recorder... Problem is, the icon moves, so the mouse doesn't always hit it.

I was trying to get the handle of the icon in the system tray, and this is where I got stuck :/ I google'd and found that someone else like me asked the same question and was not helped ( http://www.autoitscript.com/forum/index.ph...w=&st=& )

I also read up on the WinGetHandle function, as well as ued a 3rd party program (Greatis Windowse) with no luck of locating a way to get the handle...

Can someone please help me?

--KM

Share this post


Link to post
Share on other sites



Hi,

try this:

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

Global $title = "XXX"
;Global $prcoess = "icqlite.exe"
Global $prcoess = "winampa.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   ;==>clickSysTray

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

Share this post


Link to post
Share on other sites

Hi,

try this:

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

Global $title = "XXX"
;Global $prcoess = "icqlite.exe"
Global $prcoess = "winampa.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   ;==>clickSysTray

So long,

Mega

th.meger u rule!!! YAAAY! I can kill comodo now :)

Share this post


Link to post
Share on other sites

HI,

glad I could help you.

So long,

Mega

P.S: Why didn't you use Processkill for killing?


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

Share this post


Link to post
Share on other sites

Systray.au3 is gone from my include folder.

I'm using beta version of newest autoit

Share this post


Link to post
Share on other sites

Systray.au3 is gone from my include folder.

I'm using beta version of newest autoit

HI,

so you need to download it again? :shocked:

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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

okey. I could do that.

what I meant was in my setup this file is gone.

have it been removed in later autoit's or is it just my setup that is screwy?

and by what you posted as the last comment, I guess my setup is absolete.

thanks

Edited by thor918

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