Sign in to follow this  
Followers 0
NickolasC

Finding the handle of a tray icon trough its name

4 posts in this topic

Hello!

I have found the previous posts on this forum and I am successfuly running the example utilizing this method:

If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1

This is an icon that turns on/off a service. The first time I run the script, it successfully turns the service on.

But when I revert the service and try for the second time, the scrpit can't find the control anymore. This happens for every consecutive try. It only works when it runs after the first login to the OS.

The text of the tooltip is still there when I mouseover, but when I loop trough the icons and have a look at the retrieved names with a Msgbox popup, I see the name of the icon as NULL/empty. The tragetting utility shows the control and its contents, and the name is there, but the script is unable to get it right.

Can you think of what can be causing this behaviour?

Is it possible to target the control by the executable file name rather than browsing the tooltips?

Thanks! :mellow:

Share this post


Link to post
Share on other sites



NickolasC,

Welcome to the AutoIt forum. :(

That code looks familiar..... :mellow:

You might want to try altering the code slightly to this (someone pointed out the other day that is was a bit restrictive as it was):

If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0

What service are you trying to automate? Are you sure the text is identical in both cases?

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

I am trying to automate connecting EasySet, a Samsung Telecom software, the text is "Let's connect system". When it is connected, the text does change, but when I disconnect it is again set to the same initial Text. But as I said, I loop trough the icons to MsgBox the text of each, and the value is null. It works by logging out/in of windows, but only once. It feels like the text is updated but wherever AutoIT gets the value from has the text registered as Null even tough it is visible on mouseover. I did double check that it is the same text. It toggles between "Let's connect system" and "Connected".

Is it the single quote messing things up again? : )

Share this post


Link to post
Share on other sites

NickolasC,

If you can get a value for $iSystray_ButtonNumber once, it should remain valid until the system reboots as any subsequent tray icons will take the next number in the queue - unless you start closing icons ahead of course. :(

So perhaps if you set up a variable to retain the value you obtain on the first call, you might be able to continue to access the icon despite its (seeming) lack of tooltip text.

Sorry I cannot be of more help - I have never met an icon with a tooltip that the script cannot read before. :mellow:

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