|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
1) Is it possible to force the XNotify dialog (if open) when trying to access the following menu code. menu * {
X-Notify
.Dialog : dialog $iif(!$dialog(XNotify),-md,-ev) XNotify XNotify
.E-mail Contact : url -n mailto:r.k.bairstow@gmail.com?Subject=XNotify
.$iif($menu == nicklist && $$1,X-Notify Nick Blocks)
..$iif($hget($hsh(Xnotify),$+($network,.,$chan,.,$$1)),Un-) $+ Block $$1 on $chan ( $network ) from XNotify : block $network $chan $$1
.$iif($chan,X-Notify Channel Blocks)
..$iif($hget($hsh(Xnotify),$+($network,.,$chan)),Un-) $+ Block $chan on $network from XNotify : block $network $chan
.XNotify Network Blocks
..$iif($hget($hsh(Xnotify),$network),Un-) $+ Block $network from XNotify : block $network
}
2) Can the following alias be condensed/re-written better alias -l block {
if !$isid {
if $3 {
.hadd -m $hsh(XNotify) $+($1,.,$2,.,$3) $iif(!$hget($hsh(Xnotify),$+($1,.,$2,.,$3)),$3)
$iif(!$dialog(XNotify),echo -a $3 on $2 ( $1 ) $iif(!$v1,Un-) $+ Blocked from XNotify)
}
elseif $2 {
.hadd -m $hsh(XNotify) $+($1,.,$2) $iif(!$hget($hsh(Xnotify),$+($1,.,$2)),$2)
$iif(!$dialog(XNotify),echo -a $2 on $1 $iif(!$v1,Un-) $+ Blocked from XNotify)
}
else {
.hadd -m $hsh(XNotify) $1 $iif($hget($hsh(Xnotify),$1),$1)
$iif(!$dialog(XNotify),echo -a $1 $iif(!$v1,Un-) $+ Blocked from XNotify)
}
}
else {
return $iif($hget($hsh(Xnotify),$+($1,.,$2,.,$3)),$v1,$iif($hget($hsh(Xnotify),$+($1,.,$2)),$v1,$iif($hget($hsh(Xnotify),$1),$v1,$false)))
}
}
|
|
|
|
Joined: Jul 2006
Posts: 4,155
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,155 |
1) don't see what you mean by "force the XNotify dialog" 2) this *should* work : alias -l block {
var %1 $+($1,$iif($2,. $2),$iif($3,. $3)) ,%2 $dialog(Xnotify) ,%3 $hsh(Xnotify)
if $isid return $iif($hget(%3,%1),$v1,$false)
else .hadd -m %3 %1 $iif(!$hget(%3,%1) && (($2) || ($3)),$($ $+ $0,2),$1) | $iif(!%2,echo -a $iif($3,$3 on $2 ( $1 ),$iif($2,$2 on $1)) $iif(!%2,Un-) $+ Blocked from XNotify)
} But there is something i don't understand in your code, in the /echo part you were using $iif(!$v1,Un-), and actually in your code, the last comparaison was in the $iif itself so if the $iif is true, $v1 is $true in all case.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: Aug 2004
Posts: 7,252
Hoopy frood
|
OP
Hoopy frood
Joined: Aug 2004
Posts: 7,252 |
1) If the Xnotify dialog is open (either minimized or hidden by other screens on top of it), then when selecting XNotify in the menu, I want the dialog to be used (same as if selecting XNotify - Dialog) but without having to make that second selection. ie: I only want the Menu options to show if the dialog is closed. Hopefully one of the two descriptions above will make this clearer. 2) thanks for the code and the note.. reading your note and then checking my actual code made me realize that I had posted old code. My apologies. Here's the correct code for the block alias as I currently have it. I don't know if this will make a difference to your suggestion or not. alias -l block {
if !$isid {
if $3 {
.hadd -m $hsh(XNotify) $+($1,.,$2,.,$3) $iif(!$hget($hsh(Xnotify),$+($1,.,$2,.,$3)),$3)
echo -a $3 on $2 ( $1 ) $iif(!$hget($hsh(XNotify),$+($1,.,$2,.,$3)),Un-) $+ Blocked from XNotify
}
elseif $2 {
.hadd -m $hsh(XNotify) $+($1,.,$2) $iif(!$hget($hsh(Xnotify),$+($1,.,$2)),$2)
echo -a $2 on $1 $iif(!$hget($hsh(XNotify),$+($1,.,$2)),Un-) $+ Blocked from XNotify
}
else {
.hadd -m $hsh(XNotify) $1 $iif($hget($hsh(Xnotify),$1),$1)
echo -a $1 $iif(!$hget($hsh(XNotify),$1,Un-) $+ Blocked from XNotify
}
}
else {
return $iif($hget($hsh(Xnotify),$+($1,.,$2,.,$3)),$v1,$iif($hget($hsh(Xnotify),$+($1,.,$2)),$v1,$iif($hget($hsh(Xnotify),$1),$v1,$false)))
}
}
Regretfully testing your suggestion shows that the menu option always shows as Block and the echo always returns Un-Blocked.
|
|
|
|
Joined: Dec 2002
Posts: 2,962
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 2,962 |
1) If it's just that submenu then you can use: $iif(!$dialog(XNotify), XNotify)If there's more to the menu at the root level then it would be much cleaner to use groups. eg. #xnotify off
menu * {
...
}
#xnotify end and simply /enable & /disable on dialog close and open respectively. 2) This is some code in desperate need of variables: alias -l block {
if !$isid {
var %item = $replace($1-3, $chr(32), .)
var %value = $gettok(%item, -1, 44)
var %on = $iif($2, on $gettok(%item, -2, 44))
var %parens = $iif($3, $chr(40) 1 $chr(41))
.hadd -m $hsh(XNotify) %item $iif(!$hget($hsh(Xnotify),%item), %value)
echo -a %value %on %parens $iif(!$hget($hsh(XNotify),%item),Un-) $+ Blocked from XNotify
}
else {
return $iif($hget($hsh(Xnotify),$+($1,.,$2,.,$3)),$v1,$iif($hget($hsh(Xnotify),$+($1,.,$2)),$v1,$iif($hget($hsh(Xnotify),$1),$v1,$false)))
}
} I did this in a hurry so I didn't have time to test it or take a look at the final line (where $isid is $true), however I think the point you can take is this: Use variables with simple expressions instead of trying to evaluate everything all on one line - you'll be doing yourself a huge favour.
Spelling mistakes, grammatical errors, and stupid comments are intentional.
|
|
|
|
|