Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias pid {
- if (!$isid) { return }
- var %r = $ticks $+ $rand(1111,9999)
- var %1 = pid_locator_ $+ %r
- var %2 = pid_services_ $+ %r
- var %3 = pid_result_ $+ %r
- if ($com(%1)) { .comclose $v1 }
- if ($com(%2)) { .comclose $v1 }
- if ($com(%3)) { .comclose $v1 }
- .comopen %1 WbemScripting.SWbemLocator
- if ($comerr) { goto end }
- if (!$com(%1,ConnectServer,3,dispatch* %2)) && ($comerr) { goto end }
- if (!$com(%2,ExecQuery,3,bstr,SELECT * FROM Win32_Process WHERE ExecutablePath = $qt($replace($mircexe,\,\\)),dispatch* %3)) && ($comerr) { goto end }
- if (!$com(%3,Count,3)) { goto end }
- var %res = $com(%3).result
- if (%res) { var %pid = $comval(%3,1,ProcessId,0) }
- :end
- if ($com(%1)) { .comclose $v1 }
- if ($com(%2)) { .comclose $v1 }
- if ($com(%3)) { .comclose $v1 }
- return $iif(%pid,$v1,0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement