mIRC Homepage
Posted By: MDA Commands to Close a window/application needed - 15/10/05 03:22 AM
Greetings,

I have a timer set to open mIRC and a alias task set to access a website.

alias performtask {
url ]http://somesite.com[/url]
}

1) After performing that alias task, how do I automatically close that internet window/browser application?

2) Is there a mIRC command to minimize the browser window produced via the command url http://somesite.com when it is first activated?

Thanks to each for your time and consideration,

MDA
There is no flag to open the external browser window minimised, nor a built in command for closing it again.
Killing a task is possible with coms:
qwerty's method with COM

Minimizing is something i havent seen around yet with COM but i doubt its not possible.
/*

Usage:

/ie.navigate <url>
/ie.minimize
/ie.quit

Examples:

//ie.navigate www.mirc.com | ie.minimize
//ie.navigate www.winamp.com | .timer 1 5 ie.minimize | .timer 1 8 ie.quit

Note that you can use /ie.navigate <url> repeatedly once you've done it the first time. It will simply navigate to the new url specified. In other words, you don't need to /ie.quit if all you want to do is navigate to another page.

Note that once you have minimized the ie window, when navigating after that you don't have to call /ie.minimize anymore, it'll stay minimized until you manually maximize it or put it as active window.

This will always open an Internetexplorer window, even when your default browser is Mozilla firefox.

Just so you are clear on the matter, you can only use /ie.minimize and /ie.quit if you've previously opened a window with /ie.navigate. In other words, if you externally open a browser window, those commands will have no effect.

*/

Code:
alias ie.navigate {
  var %tmp = $$1, %open = .comopen ie internetexplorer.application
  if (!$com(ie)) %open
  elseif (!$com(ie,visible,2)) { .comclose ie | %open }
  if (!$com(ie).result) %tmp = $com(ie,visible,4,bool,true)
  %tmp = $com(ie,navigate,1,bstr*,$1)
}

alias ie.minimize {
  var %tmp = $$com(ie), %wsh = wsh $+ $ticks
  %tmp = $com(ie,locationname,3)
  .comopen %wsh wscript.shell
  %tmp = $com(%wsh,appactivate,1,bstr*,$com(ie).result)
  %tmp = $ticks + 200
  while ($ticks &lt; %tmp) !
  .comclose %wsh $com(%wsh,sendkeys,1,bstr*,% n)
}

alias ie.quit {
  if ($com(ie)) .comclose ie $com(ie,quit,1)
}


The ie.navigate alias is a bit ugly because if you would open a browser window with /ie.navigate, and then close it by clicking the "X" or pressing alt+f4, the object would remain open, but we would have lost control over it. This issue doesn't exist anymore now.

Btw does it really need to open an external browser window? Because you could have a browser window within your mIRC using nHTMLn
i wondered how long it would take you :P
© mIRC Discussion Forums