I don't understand the documentation example of ComObjGet. There is the line if queryEnum[process] where I don't know where the process-Variable is going to be initialized. Rename processto another variablename (e.g. queryprocess) will fail. Could someone please explain?
Code: Select all
; Example: Press Shift+Escape to show the command line which was used
; to launch the active window's process. Requires XP or later.
+Esc::
WinGet pid, PID, A
; Get WMI service object.
wmi := ComObjGet("winmgmts:")
; Run query to retrieve matching process(es).
queryEnum := wmi.ExecQuery(""
. "Select * from Win32_Process where ProcessId=" . pid)
._NewEnum()
; Get first matching process.
if queryEnum[process] ; ----> Question: where does process variable come from?
MsgBox 0, Command line, % process.CommandLine
else
MsgBox Process not found!
; Free all global objects (not necessary when using local vars).
wmi := queryEnum := process := ""
return