mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2008
Posts: 7
I
iAlex94 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2008
Posts: 7
Hi, I'm heavy mIRC user. using it 18 hours a day, I have heavly modified it. The problem is that I've seen users of the application "Linkinus" listing the current runing applications on their Mac OSX. I wonder if someone please would be able to make this for mIRC too, I'm ok with Dll's or COM connections. I just want the script. Please try :\ Thanks in advance.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
I forget who wrote this, but:

Code:
getinfo {
  if ($isid) && ($1) && ($prop) {
    if ($com(Locator)) { .comclose Locator }
    if ($com(Services)) { .comclose Services }
    if ($com(Instances)) { .comclose Instances }
    .comopen Locator WbemScripting.SWbemLocator
    if ($comerr) { .comclose Locator | return }
    var %com = $com(Locator,ConnectServer,3,dispatch* Services)
    .comclose Locator
    if $com(Services) {
      var %com = $com(Services, InstancesOf,3,string,$$1,dispatch* Instances)
      .comclose Services
    }
    if $com(Instances) {
      var %com = $com(Instances,Count,3)
      var %r = $comval(Instances,$iif($2,$2,1),$prop)
      .comclose Instances
    }
    return %r
  }
}
processes {
  echo -a Number Of Processes: $getinfo(Win32_OperatingSystem,1).NumberOfProcesses
  var %x = 1
  while (%x <= $getinfo(Win32_OperatingSystem,1).NumberOfProcesses) {
    echo -a ( $+ %x $+ ) Process: $getinfo(Win32_Process,[ %x ]).Caption (Priority: $getinfo(Win32_Process,[ %x ]).Priority $+ )
    inc %x
  }
}

killprocess {
  var %e = echo -ac info * /killprocess:
  if ($version < 6.16) { %e snippet requires mIRC 6.16 or higher | return }
  if ($1 !isnum 0-) || ($0 < 2) { %e <N> <process> with N zero or higher | return }
  var %a = a $+ $ticks, %b = b $+ %a, %c
  .comopen %a WbemScripting.SWbemLocator 
  if ($comerr) { %e error connecting to WMI | return }
  .comclose %a $com(%a,ConnectServer,1,dispatch* %b) 
  if ($com(%b)) .comclose %b $com(%b,ExecQuery,1,bstr*,SELECT $&
    Name FROM Win32_Process WHERE Name = $+(",$2-,"),dispatch* %a) 
  if (!$com(%a)) { %e error retrieving collection | return }
  %c = $comval(%a,0)
  if (!%c) { %e no such process $2 | return }
  if (!$1) {
    while (%c) {
      !.echo -q $comval(%a,%c,Terminate) 
      dec %c 
    } 
  }
  else !.echo -q $comval(%a,$1,Terminate) 
  :error
  if ($com(%a)) .comclose %a
  if ($com(%b)) .comclose %b
}

count_processes {
  var %a = a $+ $ticks, %b = b $+ %a, %c
  .comopen %a WbemScripting.SWbemLocator 
  .comclose %a $com(%a,ConnectServer,1,dispatch* %b) 
  if ($com(%b)) .comclose %b $com(%b,ExecQuery,1,bstr*,SELECT $&
    Name FROM Win32_Process WHERE Name LIKE $+(",$1,"),dispatch* %a) 
  %c = $comval(%a,0)
  if ($com(%a)) .comclose %a
  if ($com(%b)) .comclose %b
  return %c
}


/processes would list all processes


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2008
Posts: 7
I
iAlex94 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2008
Posts: 7
nice smile Would it be possible to only list the "visible applications"? like only onees displayed on the "Application" list on Task manager

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
It would be possible but I don't have such a script. I imagine a DLL could do it by enumerating all parent windows.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Dec 2008
Posts: 7
I
iAlex94 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2008
Posts: 7
I see :x thanks for replying to me smile I tried extracting it out of the processes by making it ignore runing windows processes but it crashes my mIRC.. I probably messed something wrong with the while() :\ oh well I guess I'll try to wait for someone to reply smile
I guess what makes it difficult is not mIRC.. but Explorer that doesn't want to corporate with other programs..

Joined: Jul 2006
Posts: 4,149
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,149
I'm able to get the titlebar of all the application that are listed under "Application", but not their processus name

Edit : ok, I've found a way to get the process name too.

Get cwnd.dll here and then use :
Code:
alias appl {
  if (!$1) noop $dll(cwnd.dll,listing,appl)
  else tokenize 9 $1- | if (!$istok(program manager."",$2,46)) && ($5) && (!$6) echo -a $dll(cwnd.dll,getWindowThreadProcessName,$1) - $2
}


Last edited by Wims; 30/01/09 03:39 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Dec 2008
Posts: 7
I
iAlex94 Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
I
Joined: Dec 2008
Posts: 7
thanks Argv[0] and Wims smile
Modified it a bit and:
19:23:25 * @iAlex is using: mIRC, Safari, TweetDeck, Windows Live Messenger, Skype, RocketDock, Windows Explorer. (7 Applications)


Link Copied to Clipboard