mIRC Home    About    Download    Register    News    Help

Print Thread
#148044 28/04/06 09:11 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
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


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#148045 28/04/06 09:13 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Use the Search


Gone.
#148046 28/04/06 10:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
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

#148047 28/04/06 11:04 PM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.


Link Copied to Clipboard