I need a way to determine if a process with a visible window is open, using VBScript.
For example, when I close the SolidWorks window, the SolidWorks.exe process remains running.
How can I find out which is which? Any suggestions?
I need a way to determine if a process with a visible window is open, using VBScript.
For example, when I close the SolidWorks window, the SolidWorks.exe process remains running.
How can I find out which is which? Any suggestions?
Maybe you could use the command line program
tasklist.exeto find out if the right window is open.If you run
tasklist /V /FI "IMAGENAME eq sldworks.exe"and find a difference between the process you are interested in and the other one, this might work.Assuming there is a specific window title you can look for:
where
GetProcessId()is thisYou don't have to return the PID, you could also return
True/Falseor any other informationtasklistprovides. For reference, thetasklistcolumn indexes are:More advanced interaction with processes is available through the WMI. Plenty of examples how to use that in VBScript are all over the Internet. Search for
Win32_Process.