Jump to content
Sign in to follow this  
Sn3akyP3t3

Breevy minimized to task bar tray determine status enabled or disabled

Recommended Posts

Sn3akyP3t3

Breevy is a text expander tool that is a handy productivity tool. However, it can interfere with Send commands to some windows if it is enabled and has the Typo AutoCorrections library imported and the utility is enabled. I seek to determine programmatically what the status of Breevy is either Enabled or Disabled.

Via the GUI the utility presents the status as "Enabled" or "Disabled".

This was my script to test with:

;With Breevy running and minimized

If WinExists('Breevy') Then

Opt('WinDetectHiddenText', 1)

$hBreevy = WinGetHandle('Breevy')

MsgBox(0,"",WinGetText($

hBreevy))

EndIf

Results:

Breevy.exe

Summary of AutoIt v3 Window Info tool:

>>>> Window <<<<

Title: Breevy (Portable Mode)

Class: gdkWindowToplevel

Position: -8, -8

Size: 1296, 1010

Style: 0x17CF0000

ExStyle: 0x00000110

Handle: 0x00000000001309DE

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Name:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle:

>>>> Mouse <<<<

Position: 592, 10

Cursor ID: 0

Color: 0xC7D5E3

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

Breevy.exe

>>>> Hidden Text <<<<

Breevy.exe

Any tips or suggestions will be appreciated. Also, is what I'm seeking to achieve feasible via viewing text of the window when minimized to the task bar in the tray?

Share this post


Link to post
Share on other sites
Melba23

Sn3akyP3t3,

minimized to the task bar in the tray

Does the traytip or traymenu text of the app change with its status? If so then we should be able to detect that when the app is minimized to the tray. :)

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
Sn3akyP3t3

Melba23,

Yes, the status does change, but I wasn't sure how to go about reading tray icon text. Using your script from I experimented and found that the icon can be found and the enabled/disabled status can be parsed. However, is there a technique to read hidden tray icons or is the only means to do so available if the icons are visible in the tray?

Share this post


Link to post
Share on other sites
Melba23

Sn3akyP3t3,

Just action the button on the taskbar to show all the icons before actioning the one you want: ;)

#include <GuiToolBar.au3>

Global $hSysTray_Handle

HotKeySet("q", "_Show")
HotKeySet("{ESC}", "_Exit")

While 1
    Sleep(10)
WEnd

Func _Show()

    $iSysTray_ButtonNumber = _Get_Systray_Index("") ; Put your traytip text here as before <<<<<<<<<<<<<<<<<<<<<<
    If @error Then
        MsgBox(16, "Error", "Icon not found in system tray")
        Exit
    EndIf

    ; Show hidden icons <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    $hTaskBarHandle = WinGetHandle("[Class:Shell_TrayWnd]", "")
    ControlClick($hTaskBarHandle, "", "[CLASS:Button; INSTANCE:1]")

    ; Action icon <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSysTray_ButtonNumber, "right")



EndFunc   ;==>_Show

Func _Get_Systray_Index($sText)

    ; 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  tooltip
    For $iSysTray_ButtonNumber = 0 To $iSysTray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSysTray_ButtonNumber), $sText) > 0 Then ExitLoop
    Next

    If $iSysTray_ButtonNumber = $iSysTray_ButCount Then
        Return SetError(1, 0, -1) ; Not found
    Else
        Return $iSysTray_ButtonNumber ; Found
    EndIf

EndFunc   ;==>Get_SysTray_Index

Func _Exit()
    Exit
EndFunc

It works fine on Vista - you might need to check the CLASS/INSTANCE values for the "Show" button on other OSes. :)

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  

  • Similar Content

    • Chromed
      By Chromed
      If I wanted to repeatedly check only the last line from the results of a WinGetText to trigger a word match via StringRegExp what would be the code/pattern for that? 
    • trandatnh
      By trandatnh
      hi all,

      I found that the funtion WinGetText can get "visible text". But I wonder if we can write the same function in C...

      thanks
×