;########################################################## ;## Scripts Manager ## ;########################################################## ;Main dialog dialog sm { title "Scripts Management" size -1 -1 454 258 option pixels list 1, 16 24 176 112, sort size hsbar vsbar list 2, 264 24 176 112, sort size hsbar vsbar box "Loaded Scripts", 3, 8 8 192 136 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, 8 188 192 41 edit "Created By Crossfire39", 11, 16 203 172 21, read combo 17, 262 159 176 28, drop link "Get Latest Version And Support", 18, 8 237 171 16 box "Directories", 19, 255 144 192 40 box "Sub-Directories", 20, 255 188 192 40 combo 24, 262 203 176 28, drop button "Reload", 12, 16 147 55 21 button "Reload All", 13, 80 147 55 21 button "View", 27, 143 147 55 21 menu "File", 14 item "Add Directory", 15, 14 item "Exit", 16, 14, cancel menu "Tools", 21 item "Script Viewer", 26, 21 menu "Help", 25 item "Instructions", 22, 25 item "Credits", 23, 25 } ;Credits dialog 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 283 option pixels box "Instructions", 1, 6 1 299 249 button "Back", 2, 184 257 72 20, ok cancel link "Support Forum", 6, 16 259 80 16 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, 12 17 284 56 text " When you wish to add more scripts go to File --> Add Directory and browse to the directory containing your scripts and open it. Any unloaded scripts in that directory will be shown in the right list. If you wish to navigate to any subdirectories use the lower drop down meny. To load scripts use < to load them one by one, or << to load them all at once. You cannot load mirc system files.", 4, 12 74 284 95 text " Any errors that occur will be displayed in the messages box. These messages may not be visible if loading all scripts at once. ", 5, 12 168 284 56 text " The reload buttons are there for reloading scripts without having to run intialization commands again.", 7, 12 211 284 30 } dialog sm_view { title "Script Preview" size -1 -1 470 374 option pixels button "Back", 1, 365 340 88 28, ok box "Preview", 2, 8 1 458 289 edit "", 3, 16 15 438 268, read multi hsbar vsbar edit "", 4, 224 305 229 21, read box "Messages", 5, 216 290 249 41 box "Scripts", 6, 8 290 179 66 combo 7, 15 306 166 20, drop button "View", 8, 108 331 70 22 } ;Allows there to be a link to access the dialog menu * { Script Management:/dialog -mr sm sm } ;Initiated when script starts. Fills values on 1:dialog:sm:init:0:{ /Title /var %x = 1 while ( %x <= $script(0)) { /did -az sm 1 $nopath($script( %x )) /inc %x } } ;Load script on 1:dialog:sm:sclick:5:{ if ( $did(sm,2).seltext == $null ) { /did -ra sm 11 Select a script to load! } else { /LoadScript $did(sm,2).sel $+($iif($did(sm,24).seltext != $null,$did(sm,24).seltext $+ \,$did(sm,17).seltext),$did(sm,2).seltext) } } ;Loads all scripts on 1:dialog:sm:sclick:6:{ var %x = $did(sm,2).lines if ( %x == 0 ) { /did -ra sm 11 No scripts to load! | /halt } while ( %x > 0 ) { /LoadScript %x $+($iif($did(sm,24).seltext != $null,$did(sm,24).seltext $+ \,$did(sm,17).seltext),$did(sm,2,%x))) /did -ra sm 11 $str(||,%x) /dec %x } /did -ra sm 11 Loaded scripts! } ;Unloads all scripts on 1:dialog:sm:sclick:7:{ var %x = $did(sm,1).lines if ( %x == 0) { /did -ra sm 11 No Scripts to unload! } while ( %x > 0 ) { /UnloadScript %x $did(sm,1,%x) /did -ra sm 11 $str(||,%x) /dec %x } /did -ra sm 11 Unloaded scripts! } ;Unload Script on 1:dialog:sm:sclick:8:{ if ( $did(sm,1).seltext == $null ) { /did -ra sm 11 Select a script to unload! } else { /UnloadScript $did(sm,1).sel $did(sm,1).seltext } } ;Reloads one script on 1:dialog:sm:sclick:12:{ if ( $did(sm,1).seltext == $null ) { /did -ra sm 11 Select a script to reload! | /halt } if ( $script($did(sm,1).seltext) == $script ) { /did -ra sm 11 Cannot reload this script! | /halt } .reload -rs $qt($script($did(sm,1).seltext)) /did -ra sm 11 Reloaded script! } ;Reloads all scripts on 1:dialog:sm:sclick:13:{ if ( $did(sm,1).lines == 0 ) { /did -ra sm 11 No scripts to reload! | /halt } var %x = $did(sm,1).lines while ( %x > 0 ) { if ( $script($did(sm,1,%x)) != $script ) { .reload -rs $qt($script($did(sm,1,%x))) /did -ra sm 11 $str(|||,%x) } /dec %x } /did -ra sm 11 Reloaded scripts! } ;Adds a new directory. on 1:dialog:sm:menu:15:{ /var %x = $sdir($mircdir, Select a directory) /UpdateUnloadList %x if ( !$didwm(sm,17,%x)) { /did -ac sm 17 %x } /UpdateSubDirectories %x } ;Drop down list. Changes info in list box every time something is selected on 1:dialog:sm:sclick:17:{ /UpdateUnloadList $did(sm,17).seltext /UpdateSubDirectories $did(sm,17).seltext } ;Opens the swiftirc forums on 1:dialog:sm_help:sclick:6:{ run http://forum.swiftirc.net/viewtopic.php?p=61133 } ;Opens the swiftirc forums on 1:dialog:sm:sclick:18:{ run http://forum.swiftirc.net/viewtopic.php?p=61133 } ;Occurs when you select a subdirectory on 1:dialog:sm:sclick:24:{ /UpdateUnloadList $did(sm,24).seltext } ;Opens the help menu on 1:dialog:sm:menu:22:{ /dialog -m sm_help sm_help } ;Opens Credits (Please keep intact) on 1:dialog:sm:menu:23:{ /dialog -mr sm_credits sm_credits } ;Opens Viewer From Menu on 1:dialog:sm:menu:26:{ /dialog -m sm_view sm_view } on 1:dialog:sm_view:init:0:{ /var %x = 1 while ( %x <= $script(0) ) { /did -ac sm_view 7 $nopath($script(%x)) /inc %x } } ;Opens up a script in the viewer on 1:dialog:sm:sclick:27:{ /var %path = $did(sm,1).seltext if ( %path == $null ) { /did -ar sm 11 No script selected | /halt } /dialog -m sm_view sm_view /LoadPreview $did(sm,1).seltext /did -c sm_view 7 $didwm(sm_view,7,%path) } ;View a new script in viewer on 1:dialog:sm_view:sclick:8:{ if ( $did(sm_view,7).seltext == $dialog(sm_view).title ) { /did -ra sm_view 4 Already viewing script! | /halt } /LoadPreview $did(sm_view,7).seltext } ;########################################################## ;## Alias ## ;########################################################## ;Alias that updates list of subdirectories alias -l UpdateSubDirectories { /did -r sm 24 /var %y = $finddir($1-,*,0) %y = $iif(%y > 10,10,%y) while ( %y > 0 ) { /did -a sm 24 $finddir($1-,*,%y) /dec %y } } ;Alias that updates unloaded scripts list alias -l UpdateUnloadList { /did -r sm 2 /var %y = 1 while ( %y <= $findfile($1-,*.ini;*.mrc,0,0)) { ;Shows the scripts only if they are not already running if ( !$script( $findfile($1-,*.ini;*.mrc,%y,0)) ) { /did -a sm 2 $nopath($findfile($1-,*.ini;*.mrc,%y,0)) } /inc %y } } ;Alias used to load scripts alias -l LoadScript { if ( $mircdir == $did(sm,17).seltext || $mircdir == $did(sm,24).seltext) { if ( ($nopath($2-) == aliases.ini) || ($nopath($2-) == mirc.ini) || ($nopath($2-) == popups.ini) || ($nopath($2-) == perform.ini) || ($nopath($2-) == remote.ini) || ($nopath($2-) == servers.ini) ) { /did -ar sm 11 Mirc file, unable to load | /halt } } /did -az sm 1 $nopath($2-) .load -rs $qt($2-) /did -d sm 2 $1 /Title } ;Alias used to unload scripts alias -l UnloadScript { if ( $2- != $nopath($script)) { if ( ($nofile($script($2-)) == $did(sm,17).seltext) || ($nofile($script($2-)) == $+($did(sm,24).seltext,\) )) { /did -a sm 2 $2- } .unload -rs $qt($2-) /did -d sm 1 $1 /Title } else { /did -ar sm 11 Cannot remove this script! } } ;Alias to keep track of scripts loaded alias -l Title { /dialog -t sm Script Managment - $script(0) Loaded Scripts } alias -l LoadPreview { /did -r sm_view 3 var %path = $script($1-) var %y = 1 while ( %y <= $lines(%path)) { /did -i sm_view 3 %y $read(%path, nt, %y) | /inc %y } if ( $read(%path, n, %x) != $did(sm_view,3,$did(sm_view,3).lines) ) { /did -ra sm_view 4 Full script cannot be displayed } else { /did -ar sm_view 4 Script loaded successfully. } /dialog -t sm_view $1- }