Replacement for Process Exist command

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
Ciceroids
Posts: 11
Joined: 16 Apr 2016, 11:57

Replacement for Process Exist command

31 Aug 2016, 04:30

In v1.1, you could quickly test to see if a process was running using Process, Exist, eg. Process, Exist, Autohotkey.exe. The Process command and its subcommands have been removed in v2, ostensibly to be replaced by individual commands.
There appears to be no direct individual replacement for Process Exist in v2. You can build an array of open windows (including hidden ones) using WinGetList and enumerate that to find full paths using WinGetProcessPath. Each array item can then be checked against the process you are interested in. This is slow and clumsy. Am I right in thinking that there is no direct replacement for Process Exist and, if so, will a new command be created in v2?
just me
Posts: 9453
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Replacement for Process Exist command

31 Aug 2016, 04:41

Where are you looking for v2 changes? Did you read the Alphabetical Command and Function Index of the v2 documentation?
lexikos
Posts: 9583
Joined: 30 Sep 2013, 04:07
Contact:

Re: Replacement for Process Exist command

01 Sep 2016, 05:05

Process Exist was replaced with ProcessExist. Obviously.

I didn't list WinGetProcessPath in v2-changes either, yet you worked that one out. :?

Actually, I neglected to mention in v2-changes that the Process functions/commands now use a return value/OutputVar instead of ErrorLevel, but it is detailed in the full documentation.
Ciceroids wrote:You can build an array of open windows (including hidden ones) using WinGetList and enumerate that to find full paths using WinGetProcessPath. Each array item can then be checked against the process you are interested in.
You can, but why would you? If you're going to limit it to processes which own windows, you can just use WinExist() with ahk_pid/ahk_exe. That aside, Process Exist never supported "full paths", only process names, so WinGetProcessName would be more appropriate.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Albireo, Google [Bot] and 27 guests