Alias name: /marquee
Using: /marquee <dlg|cstm> <dialog-name|custom-name> <item|line> <d|t>
Comments
dlg: Select dialog
cstm: Select custom window
item: Dialog item(only list and text item)
line: Custom window line number.
space num: Space number.
d: Right rounded.
t: Left rounded.
marquee-speed: Text speed
text: Text -.)
Examples
Testing custom window: /testcstm
Testibg dialog: /testdlg
;-------------------------
;main code start
; /marquee aliases
;-------------------------
alias marquee {
var %ec = echo $colour(info) -ae * /marquee: insufficient parameters. $chr(32) $++ $&
Using: /marquee <dlg|cstm> <dialog-name|custom-name> <item|line> <space-num> <d|t> <marquee-speed> <text>
if (!$regex($1,^(dlg|cstm)$) || !$token($1-,7,32)) { %ec | return }
var %s = 1,%% = $+(mrqe,$2,-,$3,-*)
while ($timer(%s)) {
if ($regex($v1,%%)) {
$+(.timer,$v1) off
$iif($1 = dlg,did -r $2-3,dline $2 $+($3,-,$3))
break
}
inc %s
}
var %s = 1,%q = $+($iif($5 = t,$7-),$chr(160), $&
$iif($4 > $len($7-),$str($chr(160),$calc($4 - $len($7-)))),$iif($5 = d,$7-))
$iif($1 = dlg,did -a,rline) $2-3 %q
var %& = $len(%q)
while (%s <= %&) {
$+(.timermrqe,$2,-,$3,-,%s) -m 1 $calc($6*%s) $&
$iif($1 = dlg,did -r $2-3,dline $2 $+($3,-,$3)) $&
$chr(124) $iif($1 = dlg,did -a,rline) $2-3 $&
$+($right(%q,$iif($5 = t,-) $+ %s),$left(%q,$iif($5 = d,-) $+ %s)) $&
$iif(!$calc($len(%q)-%s),$chr(124) marquee $1-)
inc %s
}
}
;main code end.
;---------------------
;example codes
;---------------------
dialog test {
title "Test"
size -1 -1 168 14
option dbu
text "", 1, 13 3 144 8
}
on *:dialog:test:init:*:marquee dlg $dname 1 75 d 100 This is a test .)
alias testdlg dialog -m test test
alias testcstm window -c @test | window -daClk0 @test 0 0 400 50 | marquee cstm @test 1 100 d 100 This is a test. .)
pball: There's no problem at the code, it works completely safe. I'm sure that errors because of non-closed timers also, that's not a showcase, it's totally a fully snippet. You have to close it by your choosing use as workfull, like I i sad, that's a fully snippet command. If you don't want to see that errors you can put theese codes too, that's will fix your problem.
Code:
on :dialog::close::.timermrqe off
on :close:@:.timermrqe off
Interesting script, could perhaps use a bit more explanation since I wasn't exactly sure what it did, so if someone didn't know what marquee meant they'd probably be lost.
But I noticed two things about this script. The custom window didn't wrap the text the same as the dialog. I don't know if you did that on purpose or because it couldn't be done the same way. But it just seems inconsistent to me. Also when I closed the custom window test I got a slew of "* /did: invalid parameters" errors since I'm guessing it does a whole cycle before checking if the window is closed