mIRC Homepage
Posted By: latumus yes / no dialog - 18/10/05 11:52 PM
previous post

in the post above is my code i'm looking for the way to make my action wait for a yes / no dialog input

so what i want to happen is, if the script is triggered
it has to open a dialog box asking me if i want to act upon $9 or whatever with 2 options yes/no where no == halt

--edit--

oh and it has to remove the yes/no dialog box after like 30 seconds of no reaction so i dont wake up to 3843743 dialog boxes wink
Posted By: Rand Re: yes / no dialog - 19/10/05 06:57 AM
Well, I'm not sure what your /action, thing does.

But here is a semi-work around,

instead of doing whatever you do, in the alias action { }

Try using a /signal instead.

else { signal action # $nick %text }

....

Then you can use something like:

Code:
on *:signal:action: {
  var %input = $$input(Perform action?,y) , %chan = $1 , %nick = $2 , %text = $3-
  if (%input) { 
  ; do action here
  }
}


This doesn't solve how to make the box disappear. I'm not *entirely* sure if there's a builtin way to make the input box choose "no" after 30 seconds.

So you might actually have to make your own dialog, and use a timer to close it.
Posted By: Kelder Re: yes / no dialog - 19/10/05 09:10 AM
To close the box after 10 seconds. Best is ofcourse to include some check to verify the user hasn't clicked yet. Probably set a %variable after the $input and check for it's presence, since $active doesn't work...
//timer 1 10 sendkeys n | echo -s $input(Perform action?,y)


I didn't write this piece of magic, qwerty did apparently http://www.mircscripts.org/comments.php?cid=1581

Code:
alias sendkeys {
  var %a = sendkeys $+ $ticks 
  .comopen %a WScript.Shell 
  if !$comerr { .comclose %a $com(%a,SendKeys,3,bstr,$1-) }
}


ps: this older thread asks for something similar
Posted By: DaveC Re: yes / no dialog - 19/10/05 09:47 PM
Good move good move.

however rather than setting a var, would this work

//timer.autoinput 1 10 sendkeys n | echo -s $input(Perform action?,y) | timer.autoinput off
Posted By: Kelder Re: yes / no dialog - 21/10/05 09:14 AM
Seems the better option indeed, let's say I like to overlook obvious solutions smile

For the production version I'd also advise some dots do silence the timer output...
© mIRC Discussion Forums