Seminko Posted June 5, 2018 Share Posted June 5, 2018 (edited) 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. Any ideas? Edited June 5, 2018 by Seminko Link to comment Share on other sites More sharing options...
TheXman Posted June 5, 2018 Share Posted June 5, 2018 (edited) @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 June 5, 2018 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Seminko Posted June 6, 2018 Author Share Posted June 6, 2018 Figured it out. Used bits and pieces from this: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now