Awesum Stuff

How to Invoke an Application in the System Tray

I got into a tricky situation when I was required to invoke an Application through the Windows System Tray. The usual way of using SystemUtil.Run or WShell.Run didn’t work as  they didn’t invoke the application, they just put it in the System Tray. And I needed to simulate a click on the System Tray in order to invoke the Application.

I used the Press method of the Wintoolbar object which recognizes the objects in the System Tray on the Basis of their tooltip text. The Example shown here invokes the IP Messenger Application :-

 

 Window(“regexpwndclass:=Shell_TrayWnd”).WinButton(“nativeclass:=Button”,”index:=0″).Click
    Set toolbar=Window(“regexpwndclass:=NotifyIconOverflowWindow”).WinToolbar(“text:=Overflow Notification Area”)
    

    ip=””
    For i=1 to toolbar.GetItemsCount
        text=Cstr(toolbar.GetItem(i))
        If Instr(text,”IPMsg”)>0 Then
            ip=text    
        End If    
    Next
    
    If ip<>”” Then
        toolbar.Press ip
    Else
        Print “IP Messenger Not Found”
    End If

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s