;##########################################################
;## Scripts Manager ##
;##########################################################
dialog sm {
title "Scripts Management"
size -1 -1 454 258
option pixels
list 1, 16 24 180 140, sort size hsbar vsbar
list 2, 264 24 176 112, sort size hsbar vsbar
box "Loaded Scripts", 3, 8 8 192 162
box "Unloaded Scripts", 4, 256 8 192 136
button "Ok", 11, 376 224 71 27, ok cancel
button "<", 6, 208 24 38 24
button "<<", 7, 208 56 38 24
button ">>", 9, 208 80 38 24
button ">", 10, 208 112 38 24
combo 17, 264 152 176 28, drop
edit "", 13, 264 192 172 21, read
button "Refresh!", 5, 296 224 71 27
box "Messages", 18, 256 176 192 41
box "Total Scripts", 19, 8 172 194 40
edit "", 20, 16 187 40 21, read
menu "File", 14
item "Add Directory", 15, 14
item "Exit", 16, 14, cancel
menu "Help", 21
item "Instructions", 22, 21
item "Credits", 23, 21
}
dialog sm_credits {
title "Script Management Credits"
size -1 -1 165 65
option pixels
box "Credits", 1, 4 1 157 36
text "Crossfire39", 2, 14 14 137 17, center
button "Back", 3, 88 40 70 20, ok
}
dialog sm_help {
title "Instructions"
size -1 -1 311 273
option pixels
box "Instructions", 1, 6 1 299 241
button "Back", 2, 118 247 72 20, ok cancel
text " When you begin this script, any current scripts you have loaded will appear in the left hand list. From here you can unload any of them by using > to unload them one by one or >> to unload all your scripts at once. Afterwards press the Refresh! button to update the unloaded scripts list.", 3, 13 15 290 68
text " When you wish to add more scripts go to File --> Add Directory and browse to the directory containing your scripts and open it. Afterwards, click on the scroll down menu to select the directory of your choice. Once you select it, all .mrc and .ini files will be displayed in the right hand list. You can use < to load them one by one or << to load them all at once.", 4, 13 81 290 94
text " Any errors that occur will be displayed in the Messages box. For your convenience there is also a checkbox to enable and disable all of the remotes.", 5, 13 174 290 70
}
menu * {
Script Management:/dialog -mr sm sm
}
;Fills left list box with scripts and right drop down with their directories
on 1:dialog:sm:init:0:{
/var %x = 1
/did -ra sm 20 $script(0)
;Fills left side list box and right side drop down
while ( %x <= $script(0)) {
/did -az sm 1 $nopath($script( %x ))
if ( $didwm(sm,17,$nofile($script( %x ))) == 0 ) {
/did -a sm 17 $nofile($script( %x ))
}
/inc %x
}
}
;Refresh second list
on 1:dialog:sm:sclick:5:{
var %x = 1
/did -r sm 2
while ( %x <= $findfile($did(sm,17).seltext,*.ini;*.mrc,0)) {
if ( $script( $findfile($did(sm,17).seltext,*.ini;*.mrc, %x )) == $null ) {
/did -az sm 2 $nopath($findfile($did(sm,17).seltext,*.ini;*.mrc, %x ))
}
/inc %x
}
}
;Moves script from unloaded to loaded
on 1:dialog:sm:sclick:6:{
if ( $did(sm,2).seltext == $null ) {
/did -ra sm 13 Select a script to load!
}
else {
/did -az sm 1 $did(sm,2).seltext
.load -rs $qt($+($did(sm,17).seltext,$did(sm,2).seltext)))
/did -d sm 2 $did(sm,2).sel
/did -ar sm 13 Script Loaded!
/did -ra sm 20 $script(0)
}
}
;Loads all scripts
on 1:dialog:sm:sclick:7:{
if ( $did(sm,17).seltext == $null ) {
/did -ra sm 13 Select a script to load!
}
else {
var %x = $did(sm,2).lines
while ( %x > 0 ) {
/did -az sm 1 $did(sm,2, %x )
.load -rs $qt($+($did(sm,17).seltext,$did(sm,2, %x )))
/did -d sm 2 %x
/dec %x
}
/did -ar sm 13 All Scripts Loaded
/did -ra sm 20 $script(0)
}
}
;Unloads all scripts
on 1:dialog:sm:sclick:9:{
var %x = $did(sm,1).lines
while ( %x > 0 ) {
if ( $did(sm,1, %x ) != $nopath($script)) {
.unload -rs $qt($did(sm,1, %x ))
/did -d sm 1 %x
}
/dec %x
}
/did -ar sm 13 All Scripts Unloaded
/did -ra sm 20 $script(0)
}
;Moves script from loaded to unloaded
on 1:dialog:sm:sclick:10:{
if ( $did(sm,1).seltext == $null ) {
/did -ra sm 13 Select a script to unload!
}
else {
if ( $did(sm,1).seltext != $nopath($script)) {
.unload -rs $qt($did(sm,1).seltext)
/did -d sm 1 $did(sm,1).sel
/did -ar sm 13 Script Unloaded!
/did -ra sm 20 $script(0)
}
else { /did -ar sm 13 Cannot remove this script! }
}
}
;Adds a new directory.
on 1:dialog:sm:menu:15:{
/var %x = $sdir(c:, Select a directory)
/did -r sm 2
/var %y = 1
while ( %y <= $findfile(%x,*.ini;*.mrc,0)) {
;Shows the scripts only if they are not already running
if ( !$script( $findfile(%x,*.ini;*.mrc,%y)) ) {
/did -a sm 2 $nopath($findfile(%x,*.ini;*.mrc,%y))
}
;Adds and selects the directory in the listbox
if ( !$didwm(sm,17,%x)) {
/did -ac sm 17 %x
}
/inc %y
}
}
;Drop down list. Changes info in list box every time something is selected
on 1:dialog:sm:sclick:17:{
/did -r sm 2
/var %x = 1
while ( %x <= $findfile($did(sm,17).seltext,*.ini;*.mrc,0)) {
if ( !$script( $findfile($did(sm,17).seltext,*.ini;*.mrc,%x)) ) {
/did -az sm 2 $nopath($findfile($did(sm,17).seltext,*.ini;*.mrc,%x))
}
/inc %x
}
}
on 1:dialog:sm:menu:22:{
/dialog -m sm_help sm_help
}
on 1:dialog:sm:menu:23:{
/dialog -mr sm_credits sm_credits
}