mIRC Home    About    Download    Register    News    Help

Print Thread
#267358 12/06/20 10:36 PM
Joined: Jul 2014
Posts: 308
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 308
Hi
I need your help people. I want to put first one IF the input is not filled and the OK button is pressed, return the following input "you must fill in the field". I put it like this:

Code

 var %x = $$input(Enter an exclude in nick!ident@host format!,evu,Add)
 if (%x == $null) && (%x != $false) { return $input(You need to fill in the field!,io,Info) }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }


But I do not want that when the Cancel button is pressed the input appears and I am not getting it.

Is there a way to solve it?

Last edited by TECO; 12/06/20 10:42 PM.

TECO
irc.PTirc.org (Co-Admin)
TECO #267359 12/06/20 10:59 PM
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Use the 'f' switch, if ok is pressed, you'll get the content as usual, but if cancel or no is pressed, you'll get $cancel or $no (plain text)


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
TECO #267360 13/06/20 05:16 AM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It appears the 'v' switch has no effect in combo with the 'e' switch. I can't get there to be any difference in clicking with an empty editbox on yes/no/cancel:

//echo -a $input(test,evn)

I dunno if that's 'by design' or something that could be added by a feature request. Obviously there's no reason for the 'yes' button to return $true when there's an editbox, but there could be use cases where clicking on no or cancel would behave the same as if typing $false or $cancel into the editbox then clicking yes.

But also, in your example you're using the double dollar, so that's going to halt rather than setting %x to null.

Joined: Jul 2014
Posts: 308
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 308
I understand what you mean, but in the context I want, I only want to have an input with just two buttons. OK and Cancel. So thanks anyway.


TECO
irc.PTirc.org (Co-Admin)
TECO #267362 13/06/20 08:59 PM
Joined: Jul 2014
Posts: 308
TECO Offline OP
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
Joined: Jul 2014
Posts: 308
I found the solution wink

Thanks Wims for the tip.

Code
 var %x = $input(Enter an exclude in nick!ident@host format!,euf,Add)
 if (%x == $null) && (%x != $false) { return $input(You have to fill out editbox!,iuo,Info) }
 elseif (%x == $false) { $null }
 elseif (*!*@* !iswm %x) { errdialog You have to enter an exclude in nick!ident@host format! }
 elseif ($hget(pexclude,%x)) { errdialog You already added this exclude! }
 else {
    hadd pexclude %x 1
    hsave -ob pexclude $_tabdir(pexclude.tbl)
    did -a $dname 2 %x
    did -e $dname 6
  }

Last edited by TECO; 13/06/20 10:40 PM.

TECO
irc.PTirc.org (Co-Admin)

Link Copied to Clipboard