How to get the total number of processes with the same name? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
afe
Posts: 615
Joined: 06 Dec 2018, 04:36

How to get the total number of processes with the same name?

11 Jan 2020, 05:07

How to get the total number of processes with the same name?

I try to use
Process, Exist, PIDOrName
, but it can only return the PID of one process, is there any other way?
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: How to get the total number of processes with the same name?  Topic is solved

11 Jan 2020, 06:33

Some like this ?

Code: Select all

Gui, Add, listview	, w1000 h300,Name|Cmdline|Pid
for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where CommandLine like '%autohotkey%'")
{   	
	pNam := process.Name
	pCom := process.CommandLine
	pPid := process.ProcessId
	lv_add("", pNam, pCom, pPid)		
}
LV_ModifyCol(1,150)
LV_ModifyCol(2,650)
LV_ModifyCol(3,"100 Integer")
Gui, Show
return

GuiEscape:
GuiClose:
*Esc::
   ExitApp
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
Rohwedder
Posts: 7644
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to get the total number of processes with the same name?

11 Jan 2020, 06:41

Hallo,
try:

Code: Select all

No := 0, ProzessName := "Firefox.exe"
for Prozess in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process")
    No += Prozess.Name = ProzessName
MsgBox,% No " " ProzessName

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, jaka1, LuckyJoe, Rohwedder and 331 guests