Just a simple scriptmanager. Doesn't do much, but does it well.
Should be quite obvious how it works. ;_)
also, my first released dialog, after playing with it the past few days... more to come... :_)
Edit: changed to v1.1, also supports multi-unload, next to the already present multi-load.
Edit2: changed to v1.2, slightly changed the dialog, fixed some major typos, added errormessages and stuff like that.
on *:LOAD: {
echo -a zScriptManager 1.2, by Knoeki.
echo -a Type /z.mrcmgr to run, or use the menus.
}
dialog z.mrcmgr {
title "zScriptManager [/z.mrcmgr]"
size -1 -1 130 180
option dbu
box "Loaded scripts", 1, 0 0 130 165
list 2, 4 8 122 153, sort size extsel
button "Unload", 3, 0 167 37 12
button "Load...", 4, 38 167 37 12
button "Exit", 5, 93 167 37 12, cancel
}
dialog z.mrcmgr.error {
title "zMrcmgr - Error"
size -1 -1 82 28
option dbu
text "", 1, 0 2 81 10, center
button "Ok", 2, 22 14 37 12, ok
}
;Main dialog init.
on *:DIALOG:z.mrcmgr:init:0: {
refresh
}
;Clicking the unload button...
on *:DIALOG:z.mrcmgr:sclick:3: {
if ($did(2, $did(2).sel).text != $null) {
if ($v1 != $nopath($script)) {
var %x 1
while (%x <= $did(2, 0).sel) {
unload -rs $did(2, $did(2, %x).sel).text
inc %x
}
refresh
}
else {
error I cannot unload myself.
}
}
else {
error No script selected.
}
}
;Clicking the load button...
on *:DIALOG:z.mrcmgr:sclick:4: {
var %loadfiles $msfile($mircdir, Select files to load...)
if (%loadfiles > 0) {
var %x 1
while (%x <= %loadfiles) {
.load -rs $qt($msfile(%x))
inc %x
}
refresh
}
}
;Errorbox handling.
on *:DIALOG:z.mrcmgr.error:init:0: {
did -a z.mrcmgr.error 1 %z.mrcmgr.error
}
on *:DIALOG:z.mrcmgr.error:close:0: {
unset %z.mrcmgr.error
}
;The alias that starts this all ;_)
alias z.mrcmgr {
if ($dialog(z.mrcmgr) == $null) {
dialog -m z.mrcmgr z.mrcmgr
}
}
;refresh list of scripts.
alias -l refresh {
did -r z.mrcmgr 2
var %x 1
while (%x <= $script(0)) {
did -a z.mrcmgr 2 $gettok($script(%x), -1, 92)
inc %x
}
did -o z.mrcmgr 1 1 $script(0) scripts loaded.
}
;output an error message.
alias -l error {
set %z.mrcmgr.error $1-
dialog -m z.mrcmgr.error z.mrcmgr.error
}
;add a nice popup menu :_)
menu status,menubar,channel {
.-
.zOWB
..zScriptManager:/z.mrcmgr
}