Advertisement
westor

$PID for Koragg v1.0

Oct 4th, 2020
1,985
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 0.84 KB | None | 0 0
  1. alias pid {
  2.   if (!$isid) { return }
  3.  
  4.   var %r = $ticks $+ $rand(1111,9999)
  5.   var %1 = pid_locator_ $+ %r
  6.   var %2 = pid_services_ $+ %r
  7.   var %3 = pid_result_ $+ %r
  8.  
  9.   if ($com(%1)) { .comclose $v1 }
  10.   if ($com(%2)) { .comclose $v1 }
  11.   if ($com(%3)) { .comclose $v1 }
  12.  
  13.   .comopen %1 WbemScripting.SWbemLocator
  14.  
  15.   if ($comerr) { goto end }
  16.  
  17.   if (!$com(%1,ConnectServer,3,dispatch* %2)) && ($comerr) { goto end }
  18.   if (!$com(%2,ExecQuery,3,bstr,SELECT * FROM Win32_Process WHERE ExecutablePath = $qt($replace($mircexe,\,\\)),dispatch* %3)) && ($comerr) { goto end }
  19.   if (!$com(%3,Count,3)) { goto end }
  20.  
  21.   var %res = $com(%3).result
  22.   if (%res) { var %pid = $comval(%3,1,ProcessId,0) }
  23.  
  24.   :end
  25.  
  26.   if ($com(%1)) { .comclose $v1 }
  27.   if ($com(%2)) { .comclose $v1 }
  28.   if ($com(%3)) { .comclose $v1 }
  29.  
  30.   return $iif(%pid,$v1,0)
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement