Thanks for the code, but seems like I explained the problem poorly. I should have provided more code from my script.
Code: Select all
ProcessList:
Global processesSnapshot := [], Global scriptsSnapshot := [], Global indexScripts := 0, Global indexProcesses := 0
For Process In ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process") ; Parsing through a list of running processes to filter out non-ahk ones (filters are based on "If RegExMatch" rules).
{ ; A list of accessible parameters related to the running processes: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394372%28v=vs.85%29.aspx
indexProcesses++
processesSnapshot[indexProcesses, "pid"] := Process.ProcessId ; Fulfilling the array processesSnapshot with processes' PIDs
processesSnapshot[indexProcesses, "exe"] := Process.ExecutablePath ; Fulfulling the array processesSnapshot with processes executables' paths.
; processesSnapshot[indexProcesses, "cmd"] := Process.CommandLine
If (RegExMatch(Process.CommandLine, "Si)^(""|\s)*\Q" A_AhkPath "\E.*\\(?<Name>.*\.ahk)(""|\s)*$", script)) && (RegExMatch(Process.CommandLine, "Si)^(""|\s)*\Q" A_AhkPath "\E.*""(?<Path>.*\.ahk)(""|\s)*$", script))
{
indexScripts++
scriptsSnapshot[indexScripts, "pid"] := Process.ProcessId ; Using "ProcessId" param to fulfill our "pidsArray" array.
scriptsSnapshot[indexScripts, "name"] := scriptName ; The first RegExMatch outputs to "scriptName" variable, who's contents we use to fulfill our "scriptNamesArray" array.
scriptsSnapshot[indexScripts, "path"] := scriptPath ; The second RegExMatch outputs to "scriptPath" variable, who's contents we use to fulfill our "scriptPathArray" array.
}
}
Return
That function of yours seems to just retrieve the total number of running processes upon calling it, and I need to gather
per-process info into an array or an Object (but I don't know how to work with objects) to save these data for later parsing.
question := (2b) || !(2b) © Shakespeare.