;##########################################################
;## Scripts Manager ##
;##########################################################
dialog sm {
title "Scripts Management"
size -1 -1 454 258
option pixels
list 1, 16 24 177 147, sort size hsbar vsbar
list 2, 264 24 176 112, sort size hsbar vsbar
box "Loaded Scripts", 3, 8 8 192 171
box "Unloaded Scripts", 4, 256 8 192 136
button "<", 5, 208 24 38 24
button "<<", 6, 208 56 38 24
button ">>", 7, 208 80 38 24
button ">", 8, 208 112 38 24
button "Ok", 9, 374 230 73 23, ok cancel
box "Messages", 10, 256 184 192 41
edit "Created By Crossfire39", 11, 264 199 172 21, read
box "Total Loaded Scripts", 12, 8 184 192 41
edit "", 13, 16 200 40 21, read
combo 17, 264 159 176 28, drop
link "Get Latest Version", 18, 8 237 171 16
box "Directories", 19, 255 144 192 40
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.", 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 13 $script(0)
;Fills left side list box and right side drop down
while ( %x <= $script(0)) {
/did -az sm 1 $nopath($script( %x ))
/inc %x
}
}
;Moves script from unloaded to loaded
on 1:dialog:sm:sclick:5:{
if ( $did(sm,2).seltext == $null ) {
/did -ra sm 11 Select a script to load!
}
else {
if ( $mircdir == $did(sm,17).seltext ) {
if ( ($did(sm,2).seltext == aliases.ini) || ($did(sm,2).seltext == mirc.ini) || ($did(sm,2).seltext == popups.ini) || ($did(sm,2).seltext == perform.ini) || ($did(sm,2).seltext == remote.ini) || ($did(sm,2).seltext == servers.ini) ) { /did -ar sm 13 Mirc file, unable to load | /halt }
}
/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 11 Script Loaded!
/did -ra sm 12 $script(0)
}
}
;Loads all scripts
on 1:dialog:sm:sclick:6:{
if ( $did(sm,17).seltext == $null ) {
/did -ra sm 11 Select a script to load!
}
else {
var %x = $did(sm,2).lines
while ( %x > 0 ) {
if ( $mircdir == $did(sm,17).seltext ) {
if ( ($did(sm,2).seltext == aliases.ini) || ($did(sm,2).seltext == mirc.ini) || ($did(sm,2).seltext == popups.ini) || ($did(sm,2).seltext == perform.ini) || ($did(sm,2).seltext == remote.ini) || ($did(sm,2).seltext == servers.ini) ) { /continue }
}
/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 11 Scripts Loaded
/did -ra sm 12 $script(0)
}
}
;Unloads all scripts
on 1:dialog:sm:sclick:7:{
var %x = $did(sm,1).lines
while ( %x > 0 ) {
if ( $did(sm,1, %x ) != $nopath($script)) {
if ( $nofile($script($did(sm,1,%x))) == $did(sm,17).seltext ) { /did -a sm 2 $did(sm,1,%x) }
.unload -rs $qt($did(sm,1, %x ))
/did -d sm 1 %x
}
/dec %x
}
/did -ar sm 11 All Scripts Unloaded
/did -ra sm 12 $script(0)
}
;Moves script from loaded to unloaded
on 1:dialog:sm:sclick:8:{
if ( $did(sm,1).seltext == $null ) { /did -ra sm 13 Select a script to unload! }
else {
if ( $did(sm,1).seltext != $nopath($script)) {
if ( $nofile($script($did(sm,1).seltext)) == $did(sm,17).seltext ) { /did -a sm 2 $did(sm,1).seltext }
.unload -rs $qt($did(sm,1).seltext)
/did -d sm 1 $did(sm,1).sel
/did -ar sm 11 Script Unloaded!
/did -ra sm 12 $script(0)
}
else { /did -ar sm 11 Cannot remove this script! }
}
}
;Adds a new directory.
on 1:dialog:sm:menu:15:{
/var %x = $sdir($mircdir, Select a directory)
/did -r sm 2
/var %y = 1
while ( %y <= $findfile(%x,*.ini;*.mrc,0,0)) {
;Shows the scripts only if they are not already running
if ( !$script( $findfile(%x,*.ini;*.mrc,%y,0)) ) {
/did -a sm 2 $nopath($findfile(%x,*.ini;*.mrc,%y,0))
}
/inc %y
}
;Adds Directory + 5 subdirectories into drop down box 17
if ( !$didwm(sm,17,%x)) { /did -ac sm 17 %x }
/var %y = $finddir(%x,*,0)
if ( %y > 0 ) {
%y = $iif(%y > 5,5,%y)
while ( %y > 0 ) {
%temp = $finddir(%x,*,%y)
if ( !$didwm(sm,17,%temp)) { /did -a sm 17 %temp }
/dec %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,0)) {
if ( !$script( $findfile($did(sm,17).seltext,*.ini;*.mrc,%x,0)) ) {
/did -az sm 2 $nopath($findfile($did(sm,17).seltext,*.ini;*.mrc,%x,0))
}
/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
}