Sign in to follow this  
Followers 0
kwapster

right click tray icon (tooltip not exist)

36 posts in this topic

i've been reading up on the forum so far and all the methods i've seen so far involves using the tooltip of the program.

The problem is this application does not use a tooltip and is integrated into internet explorer.

Plz advice

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

kwapster,

Do all the other icons present have a tooltip? :graduated:

If so then you just need to find the one that does not! ;)

M23

Edit:

Seriously, you might find the Application-defined Parameter useful.

This code lists all the existing Systray icons with their parameter and text.

#Include <GuiToolBar.au3>

$hSysTray_Handle = Get_Systray_Handle()

; Get systray item count
$iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount = 0 Then
    MsgBox(16, "", "No items found in system tray")
    Exit
EndIf

; Read tooltip text and parameter
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
    $sText =  _GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber)
    $iParam = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSystray_ButtonNumber)
    ConsoleWrite($iSystray_ButtonNumber & ": " & $iParam & " - " & $sText & @CRLF)
Next

Func Get_Systray_Handle()

    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    Else
        Return $hSysTray_Handle
    EndIf

EndFunc

If you were to run something along these lines just before you start your "no-text" app and then immediately after (I would use an array to store and compare myself) you should be able to identify the new icon and its parameter. You can then use this parameter to identify the icon in the same way as you have seen the tooltip text used elsewhere.

Alas the parameter appears not to remain the same each time you run the app - at least it certainly did not when I tried it just now on a few apps that have a systray icon - so you will have to do this every time to obtain the parameter value. :)

I hope that helps - come back if you run into problems. ;)

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

melba thanks for your reply...you seem to be an expert on this issue based on my reading.

when i run your code nothing happens though. No popup or anything. Windows 7 x64

and 1 edit to the first post. its actually explorer.exe

Share this post


Link to post
Share on other sites

kwapster,

when i run your code nothing happens though. No popup or anything

Did you run the code from within SciTE? The script should write to the console within SciTE (that is what the ConsoleWrite line does) - there are no pop-ups. ;)

And I do not understand your second point - if you have a systray icon this code should find it. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

ok melba now i understand. The output does not change before and after i run the code. Its like the app (which is actually a dll integrated as a toolbar into explorer.exe) does not exist. Its just not being detected

here is window info by the way

>>>> Window <<<<

Title:

Class: Shell_TrayWnd

Position: 0, 870

Size: 1440, 30

Style: 0x96000000

ExStyle: 0x00000088

Handle: 0x0001004E

>>>> Control <<<<

Class: WindowsForms10.window.8.app.0.378734a

Instance: 2

ClassnameNN: WindowsForms10.window.8.app.0.378734a2

Name: themedButton

Advanced (Class): [NAME:themedButton]

ID: 263874

Text: 17%

Position: 1118, 0

Size: 35, 30

ControlClick Coords: 29, 23

Style: 0x56010000

ExStyle: 0x00010000

Handle: 0x000406C2

>>>> Mouse <<<<

Position: 1147, 893

Cursor ID: 0

Color: 0x141A1F

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

1:08 PM

User Promoted Notification Area

System Promoted Notification Area

Running applications

Running applications

17%

>>>> Hidden Text <<<<

TF_FloatingLangBar_WndTitle

Share this post


Link to post
Share on other sites

kwapster,

Funniest systray icon I have ever seen! :graduated:

In fact I am not sure it is an icon at all based on that. As you have the required ID parameters, have you tried ControlClick? ;)

ControlClick("[CLASS:Shell_TrayWnd]", "", "[CLASS:WindowsForms10.Window.8.app.0.378734a; ID:263874; NAME:themedButton]", "secondary")

Any luck? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thanks melba, that worked..i tried to send an accelerator key send ("c") after that but only the right click menu shows

Share this post


Link to post
Share on other sites

kwapster,

Try using ControlSend - it is more reliable. You might need to use ControlFocus first though. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

works perfect. Thanks alot melba

Share this post


Link to post
Share on other sites

kwapster,

Glad I could help. :graduated:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba,

I have fallen into the same problem with a program called "3G Modem Connect" (http://www.codeproject.com/Articles/120638/3G-Modem-Internet-Dialer) which does not have any tooltiptext. (same problem as kwapster)

I run the script that lists all the existing Systray icons with their parameter and text and it works fine and get this :

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
0: 1423008 -
1: 79241768 - AutoIt - 3333.au3
2: 0 -
3: 37968272 - Lydstyrke
4: 0 -
5: 79251048 - Sikker fjernelse af hardware
6: 1425416 -
7: 79247568 -
8: 37857240 -
9: 38064992 -
10: 38076424 -
11: 38680704 -
12: 637368 -
13: 79231328 -
14: 38622848 -
15: 38278040 -
16: 38279144 -
17: 638472 -
18: 38144888 -
19: 37990792 -
+>01:28:50 AutoIT3.exe ended.rc:0
>Exit code: 0 Time: 2.862

And this is where I get stuck !

I get the Icon ID (3: 37968272 - Lydstyrke)

If I take the other code you have given to kwapster and put my own icon ID in, nothing happens.

ControlClick("[CLASS:Shell_TrayWnd]", "", "[CLASS:WindowsForms10.Window.8.app.0.378734a; ID:37968272; NAME:themedButton]", "secondary")

Can you give me a hand ?

Best regards - Kryder (form Denmark) :ILA3:

Share this post


Link to post
Share on other sites

kryder,

Welcome to the AutoIt forum. :)

I am confused - you say that when you use the code i posted above it gives you this result for the relevant icon:

3: 37968272 - Lydstyrke

The final part of this is returned by _GUICtrlToolbar_GetButtonText and yet you say there is no text displayed? :wacko:

However, as the function does return something (even if it is not displayed) this code should work for you: ;)

#Include <GuiToolBar.au3>

Global $hSysTray_Handle, $iSysTray_ButtonNumber

Global $sToolTipTitle = "Lydstyrke" ; <<<<<<<<<<<<<<<< The returned text for the icon

$iSysTray_ButtonNumber = Get_SysTray_Index($sToolTipTitle)

If $iSysTray_ButtonNumber = 0 Then
    MsgBox(16, "Error", "Icon not found in system tray")
    Exit
Else
    Sleep(500)
    _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSysTray_ButtonNumber, "right")
EndIf

Exit

;............

Func Get_SysTray_Index($sToolTipTitle)

    ; Find systray handle
    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf

    ; Get systray item count
    Local $iSysTray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSysTray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf

    ; Look for wanted tooltip
    For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop
    Next

    If $iSysTray_ButtonNumber = $iSysTray_ButCount Then
        Return 0 ; Not found
    Else
        Return $iSysTray_ButtonNumber ; Found
    EndIf

EndFunc

Any luck? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, M23

I'm sorry, I was wrong.

It is the icon ID " 17: 638472 - " It has no text.

You can help ?

- Kryder

Share this post


Link to post
Share on other sites

kryder,

If you reboot your machine and rerun the script, does the icon still come up with the same parameter value (638472)? :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, M23

No, now it is : 12: 20101552

- Kryder

Share this post


Link to post
Share on other sites

kryder,

I was afraid that would be the case. :(

How did you determine which icon it is in the list so that you could post the relevant parameter? Perhaps we can the same thing programatically. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, M23

1. I run the script, without the "3G Modem Connect" has been started and copy the list over to notebook

2. I run the script, with the "3G Modem Connect" started and copy the list over to notebook

3. And delete all the same ID's, and one is remaining.

- kryder

Share this post


Link to post
Share on other sites

kryder,

Then we will do the same sort of thing - only we will automate the "3G Modem Connect" as well so that you only have to click once and you get both the app running and find the correct parameter. :)

What do you use as a command line to start the app at present? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi, M23

I use : C:Programmer3G Modem Connect3GModemConnect.exe

- Kryder

Share this post


Link to post
Share on other sites

kryder,

See if this works for you - it should display a MsgBox and then open the context menu from the icon: :)

#Include <GuiToolBar.au3>

Global $hSysTray_Handle = Get_Systray_Handle()

; Get initial count
$iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount = 0 Then
    MsgBox(16, "", "No items found in system tray")
    Exit
EndIf

; Read current tooltip parameter
Global $aInitial_Array[$iSystray_ButCount + 1] = [$iSystray_ButCount]
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
    $aInitial_Array[$iSystray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSystray_ButtonNumber)
Next

; Now start the app and wait until the icon appears
Run("C:Programmer3G Modem Connect3GModemConnect.exe")
Do
    Sleep(10)
Until $iSystray_ButCount <> _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Reset the count
$iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)

; Read new tooltip parameters
Global $aFinal_Array[$iSystray_ButCount + 1] = [$iSystray_ButCount]
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
    $aFinal_Array[$iSystray_ButtonNumber + 1] = _GUICtrlToolbar_GetButtonParam($hSysTray_Handle, $iSystray_ButtonNumber)
Next

; Now check which icon is new
For $i = $aFinal_Array[0] To 1  Step -1; Start with the newest because that is probably the one we want
    For $j = 1 To $aInitial_Array[0]
        ConsoleWrite($aFinal_Array[$i] & " - " & $aInitial_Array[$j] & @CRLF)
        If $aFinal_Array[$i] = $aInitial_Array[$j] Then
            ExitLoop
        EndIf
        ; This parameter not found
        MsgBox(0, "Icon parameter", $aFinal_Array[$i] & @CRLF & "Button ID = " & $i)
        ; And a check to see if it is correct
        _GUICtrlToolbar_ClickButton($hSysTray_Handle, $i, "right")
        Exit
    Next
Next

Func Get_Systray_Handle()

    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    Else
        Return $hSysTray_Handle
    EndIf

EndFunc

Any luck? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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