Jump to content

How to check for a program tooltip in tray


Recommended Posts

I need to check if a program is running. The unfortunate thing is that it is a AutoHotkey script which doesn't have a GUI until clicked, and nobody does that for this program. I cannot even check the processes because it only says AutoHotkey.exe, if the user had multiple AHK scripts running I wouldn't be able to differentiate them. So the only thing I can think of is somehow check for icon tooltips in tray.

I've found this thread:

@Melba23's code works great but for some reason it is only able to find tooltips for programs that are in the "main panel tray" (not sure the name in english) and are visible. If the program is "consolidated" within the little arrow, the script doesn't find the tooltip.

image.png.89c90f99ecfd635d0457214a071a38a0.png

Any ideas?

Edited by Seminko
Link to comment
Share on other sites

@Seminko

One thing you could try, but since I don't use AH I wouldn't know if it works, would be to try to determine the command line used to launch the AH processes.  One way you could do it would be do parse the output of a command like:

WMIC path win32_process where name='autohotkey.exe' get Caption,Processid,Commandline

or

WMIC process where name='autohotkey.exe' get Caption,Processid,Commandline

Or you could do the same thing using code like: (but changing svchost.exe to autohotkey.exe or whatever the process name is)

#include <Constants.au3>

example()

Func example()
    Local $oWmi, $oItems
    
    $oWmi      = ObjGet("winmgmts:\\.\root\CIMV2")
    If Not IsObj($oWmi) Then Exit MsgBox($MB_ICONERROR, "ERROR", "Unable to create WMI object")

    $oItems = $oWmi.ExecQuery("SELECT * FROM Win32_Process WHERE name='svchost.exe'")
    If $oItems.Count = 0 Then Exit MsgBox($MB_ICONWARNING,"Warning","No objects found")

    For $oItem in $oItems
        With $oItem
            ConsoleWrite(StringFormat("Command Line = (%s) %s", .processid, .commandline) & @CRLF)
        EndWith
    Next
EndFunc

 

Edited by TheXman
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...