mIRC Homepage

Would really appriciate this.

Posted By: iAlex94

Would really appriciate this. - 26/01/09 07:55 PM

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.
Posted By: argv0

Re: Would really appriciate this. - 26/01/09 07:56 PM

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
Posted By: iAlex94

Re: Would really appriciate this. - 26/01/09 08:49 PM

nice smile Would it be possible to only list the "visible applications"? like only onees displayed on the "Application" list on Task manager
Posted By: argv0

Re: Would really appriciate this. - 27/01/09 12:57 AM

It would be possible but I don't have such a script. I imagine a DLL could do it by enumerating all parent windows.
Posted By: iAlex94

Re: Would really appriciate this. - 30/01/09 02:21 PM

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..
Posted By: Wims

Re: Would really appriciate this. - 30/01/09 03:28 PM

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
}

Posted By: iAlex94

Re: Would really appriciate this. - 10/02/09 06:24 PM

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)
© 2021 mIRC Discussion Forums