mIRC Homepage
Posted By: HAMM3R $isproc() - 28/04/06 09:11 PM
I need an alias to return $true if a process is running and $false if not. Sorry i have nothing to work from, I simply wouldnt know where to start. Seems simple enough, thanks in advance.

Austin
Posted By: FiberOPtics Re: $isproc() - 28/04/06 09:13 PM
Use the Search
Posted By: SladeKraven Re: $isproc() - 28/04/06 10:57 PM
Code:
alias isprocess {
  if ($isid) {
    if ($2 !isnum 1-) { tokenize 32 $$1 1 }
    var %a = a $+ $ticks, %b = b $+ $ticks, %c = c $+ $ticks, %i = 1
    .comopen %a WbemScripting.SWbemLocator
    if ($com(%a)) {
      .comclose %a $com(%a,ConnectServer,3,dispatch* %b)
      if ($com(%b)) {
        .comclose %b $com(%b,ExecQuery,3,string,SELECT Name FROM Win32_Process WHERE Name=" $+ $1",dispatch* %c)
        if ($com(%c)) { 
          if ($comval(%c,$2,Name) == $1) {
            .comclose %c
            return $true
          }
        }
      }
    }
    if ($com(%a)) { .comclose %a }
    if ($com(%b)) { .comclose %b }
    if ($com(%c)) { .comclose %c }
    return $false
  }
}


Not sure who coded this, just used the search.

-Andy
Posted By: hixxy Re: $isproc() - 28/04/06 11:04 PM
That's mine. You'd be better off using a dll to that as it takes a couple of seconds to run on slow(ish) machines.
© mIRC Discussion Forums