mIRC Homepage
Posted By: hatch Close $input dialog - 13/01/03 02:30 AM
Hello Board!

How can I manage to close an already opened $input dialog?

My goal is to ask the user if he wants to close an incative window. I can manage that, but it would be a nice feature, to stop bothering the user if the query returns to activity while the $input dialog is already open.

Thanks for your help!
--hatch
Posted By: Dana Re: Close $input dialog - 13/01/03 05:24 AM
I don't think that this is possible at this time.

What you *can* do is to not use the $input identifier and to make your own custom dialog window instead. You can close your own dialog windows with /dialog.

If you're unfamiliar with dialogs, you can read this tutorial on dialog design and this tutorial on the more general aspects of dialogs.
Posted By: qwerty Re: Close $input dialog - 13/01/03 06:18 AM
As you've been told, you can use a dialog for that. If you want to stick to $input though there is a -kinda dirty- way to do it: set a timer to close $input after N milliseconds. How to close $input? You can use mirc's COM support to call the Sendkeys method (in WshShell) and make it 'press' Alt+F4. Here's the $tinput alias
Code:
[color:green]; syntax: $tinput(<timeout>,<param1 of $input>,<param2 of $input>,....)
; <timeout> is milliseconds, eg 3000 for a 3-second timeout.
; Example: //echo -s $tinput(4000,This dialog will close in 4 seconds,o,This is the titlebar)[/color]
alias tinput {
  if $1 !isnum 1- { return }
  .timerInput -m 1 $1 if ($appactive) sendkeys % $!+ {F4}
  var %a = $input($2,$3,$4,$5,$6)
  .timerInput off
  return %a
}
alias sendkeys {
  var %a = sendkeys $+ $ticks 
  .comopen %a WScript.Shell
  if !$comerr { .comclose %a $com(%a,SendKeys,3,bstr,$1-) }
}
© mIRC Discussion Forums