All pastes #435516 Raw Edit

Untitled

public text v1 · immutable
·published 2007-04-11 23:31 UTC
rendered paste body
;##########################################################
;##                   Scripts Manager                    ##
;##########################################################

;Main dialog
dialog sm {
  title "Scripts Management"
  size -1 -1 454 274
  option pixels
  list 1, 16 24 176 112, sort size autohs autovs hsbar vsbar
  list 2, 264 24 176 112, sort size autohs autovs hsbar vsbar
  box "Loaded Scripts", 3, 8 8 192 133
  box "Unloaded Scripts", 4, 255 9 192 133
  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 247 73 23, ok cancel
  box "Messages", 10, 8 185 192 41
  edit "Created By Crossfire39", 11, 16 202 172 21, read
  combo 17, 261 176 181 29, drop
  link "Get Latest Version And Support", 18, 8 242 171 16
  box "Directories", 19, 255 160 194 42
  box "Sub-Directories", 20, 255 201 194 42
  combo 24, 262 216 181 29, drop
  button "Reload", 12, 7 144 60 20
  button "Reload All", 13, 74 144 60 20
  button "View", 28, 141 144 60 20
  button "View", 29, 382 143 60 20
  menu "File", 14
  item "Add Directory", 15, 14
  item "Exit", 16, 14, cancel
  menu "Tools", 21
  item "Script Viewer", 26, 21
  item "Script Finder", 27, 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, 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
}

;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
  }
}

;Closes all open dialogs when main script is closed
on 1:dialog:sm:close:0:{
  if ( $dialog(sm_help) != $null ) { /dialog -x sm_help }   
  if ( $dialog(sm_search) != $null ) { /dialog -x sm_search }
  if ( $dialog(sm_view) != $null ) { /dialog -x sm_view }
  if ( $dialog(sm_view_info) != $null ) { /dialog -x sm_view_info }
  if ( $dialog(sm_view_help) != $null ) { /dialog -x sm_view_help }
  if ( $dialog(sm_credits) != $null ) { /dialog -x sm_credits }
  if ( $dialog(sm_search_help) != $null ) { /dialog -x sm_search_help }
  if ( $dialog(sm_search_confirm) != $null ) { /dialog -x sm_search_confirm }
}

;Opens up info about a loaded script
on 1:dialog:sm:dclick:1:{ /LoadViewerFileInfo $script($did(sm,1).seltext) }

;Opens up info about script
on 1:dialog:sm:dclick:2:{ /LoadViewerFileInfo $+($iif($did(sm,24).seltext != $null,$did(sm,24).seltext $+ \,$did(sm,17).seltext),$did(sm,2).seltext ) }

;Load script
on 1:dialog:sm:sclick:5:{
  if ( $did(sm,2).seltext == $null ) { /did -ra sm 11 Select a script to load! | /halt }
  /LoadScript $did(sm,2).sel $+($iif($did(sm,24).seltext != $null,$did(sm,24).seltext $+ \,$did(sm,17).seltext),$did(sm,2).seltext) 
  /did -ra sm 11 Loaded Script!
  /Title
}

;Loads all scripts
on 1:dialog:sm:sclick:6:{
  var %x = $did(sm,2).lines
  /var %y = %x
  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(|,$calc(40/ %y * %x ))
    /dec %x
  }
  /did -ra sm 11 Loaded scripts!
  /Title
}

;Unloads all scripts
on 1:dialog:sm:sclick:7:{
  var %x = $did(sm,1).lines
  /var %y = %x
  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(|,$calc(40/ %y * %x))
    /dec %x
  }
  /Title
  /did -ra sm 11 Unloaded scripts!
  /UpdateUnloadList $did(sm,17).seltext
  /UpdateSubdirectories $did(sm,17).seltext
}

;Unload Script
on 1:dialog:sm:sclick:8:{
  if ( $did(sm,1).seltext == $null ) { /did -ra sm 11 Select a script to unload! | /halt }
  /did -ra sm 11 Unloaded script!
  /UnloadScript $did(sm,1).sel $did(sm,1).seltext 
  /Title
  /UpdateUnloadList $did(sm,17).seltext
  /UpdateSubdirectories $did(sm,17).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(|,$calc(40/$script(0)* %x))
    }
    /dec %x
  }
  /did -ra sm 11 Reloaded scripts!
  /Title
}

;Adds a new directory. 
on 1:dialog:sm:menu:15:{ 
  /var %x = $sdir($mircdir, Select a directory to load)
  /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 -vm sm_help sm_help 

;Opens Credits (Please keep intact)
on 1:dialog:sm:menu:23: /dialog -vmr sm_credits sm_credits 

;Opens Viewer From Menu
on 1:dialog:sm:menu:26: /dialog -vm sm_view sm_view 

;Opens the search program
on 1:dialog:sm:menu:27: /dialog -vm sm_search sm_search

;Open viewer for unloaded script
on 1:dialog:sm:sclick:28:{
  if ( $did(sm,1).seltext == $null ) { /did -ra sm 11 Select a script to view! | /halt }
  /Dialog -vmr sm_view sm_view
  /LoadPreview $script($did(sm,1).seltext)
  /did -c sm_view 7 $didwm(sm_view,7,$did(sm,1).seltext)
}

;Open viewer for loaded script
on 1:dialog:sm:sclick:29:{
  if ( $did(sm,2).seltext == $null ) { /did -ra sm 11 Select a script to view! | /halt }
  /Dialog -vmr sm_view sm_view
  /LoadPreview $+($iif($did(sm,24).seltext != $null,$did(sm,24).seltext $+ \,$did(sm,17).seltext),$did(sm,2).seltext )
  /did -c sm_view 7 $didwm(sm_view,7,$did(sm,2).seltext)
}

;##########################################################
;##                    Scripts Viewer                    ##
;##########################################################

dialog sm_view {
  title "Script Preview"
  size -1 -1 470 398
  option pixels
  button "Back", 1, 385 372 77 22, ok cancel
  box "Preview", 2, 8 1 458 279
  edit "", 4, 314 342 143 21, read
  box "Path", 5, 8 280 346 41
  box "Loaded Scripts", 6, 8 326 264 41
  combo 7, 16 342 166 20, drop
  button "View", 8, 188 342 70 21
  box "Lines Displayed", 17, 303 326 166 41
  edit "", 18, 16 296 332 21, read autohs
  button "View Script Info", 19, 368 296 89 20
  list 3, 14 18 444 243, size hsbar vsbar
  text "", 20, 359 263 100 16, right
  menu "File", 9
  item "View File", 10, 9
  item "Exit", 11, 9, cancel
  menu "Tools", 15
  item "Script Info", 16, 15
  menu "Help", 12
  item "Instructions", 13, 12
  item "Credits", 14, 12
}

dialog sm_view_info {
  title "File Information"
  size -1 -1 310 206
  option pixels
  button "Ok", 1, 230 174 67 23, cancel
  edit "", 3, 80 24 219 21, read
  text "Filename:", 4, 16 27 51 16
  text "Path:", 5, 16 53 30 18
  edit "", 6, 80 50 218 21, read
  text "Lines:", 7, 16 157 31 16
  edit "", 8, 80 154 62 21, read
  text "Size:", 9, 16 131 31 16
  edit "", 10, 80 128 70 21, read
  text "Created:", 11, 16 79 45 16
  edit "", 12, 80 76 120 21, read
  text "Modified", 13, 16 105 50 16
  box "Script File Information", 14, 4 2 302 202
  edit "", 2, 80 102 120 21, read
  text "Script is loaded in mIRC", 15, 16 183 123 16, hide
}


dialog sm_view_help {
  title "Script Preview Instructions"
  size -1 -1 291 209
  option pixels
  button "Back", 2, 216 184 67 21, ok
  link "Support Forums", 3, 16 184 110 16
  box "Instructions", 1, 4 1 282 176
  text "     There are two ways to access this feature. The first is by selecting a loaded or unloaded script clicking the corresponding view button, or in the main screen go to Tools > Script Viewer. This small program will allow you to view the contents of a script up to 500 lines. Sometimes there may be content that does not get displayed do to program limitations. You can select other loaded scripts by using the drop down menu below, or you can go to File > View File in the Viewer and select a file. The directory will automatically get added in the main screen. ", 4, 11 16 265 155
}

;When viewer starts
on 1:dialog:sm_view:init:0:{
  /var %x = 1
  while ( %x <= $script(0) ) { 
    /did -ac sm_view 7 $nopath($script(%x))
    /inc %x 
  }
}

;Closes open dialogs
on 1:dialog:sm_view:close:0:{
  if ( $dialog(sm_view_info) != $null ) { /dialog -x sm_view_info }
  if ( $dialog(sm_view_help) != $null ) { /dialog -x sm_view_help }
  if ( $dialog(sm_credits) != $null ) { /dialog -x sm_credits }
}


on 1:dialog:sm_view:sclick:3:{
  /did -ra sm_view 20 $did(sm_view,3).sel $+ : $+ $did(sm_view,3).lines
}

;View a new script in viewer
on 1:dialog:sm_view:sclick:8:{
  if ( $did(sm_view,7).seltext == $nopath($did(sm_view,18).text) ) { /did -ra sm_view 4 Already viewing script! | /halt }
  /LoadPreview $script($did(sm_view,7).seltext)
}

on 1:dialog:sm_view:menu:10:{
  /var %file = $sfile(*.ini;*.mrc,Select a file to view)
  if ($didwm(sm,17,$nofile(%file)) == 0) { /did -ac sm 17 $nofile(%file) | /UpdateUnloadList $nofile(%file) }
  /LoadPreview %file
}

;Opens view script info from button
on 1:dialog:sm_view:sclick:19:{ 
  if ( $did(sm_view,18).text == $null ) { /did -ra sm_view 4 No script being viewed | /halt }
  /LoadViewerFileInfo $did(sm_view,18).text
}

;Opens view script dialog from menu
on 1:dialog:sm_view:menu:16:{
  if ( $did(sm_view,18).text == $null ) { /did -ra sm_view 4 No script being viewed | /halt }
  /LoadViewerFileInfo $did(sm_view,18).text
}

;Opens Credits (Please keep intact)
on 1:dialog:sm_view:menu:14: /dialog -vmr sm_credits sm_credits 

;Viewer instructions
on 1:dialog:sm_view:menu:13: /dialog -vmr sm_view_help sm_view_help 

;Opens the swiftirc forums
on 1:dialog:sm_view_help:sclick:3: run http://forum.swiftirc.net/viewtopic.php?p=61133 


;##########################################################
;##                    Scripts Search                    ##
;##########################################################
dialog sm_search {
  title "Script Search"
  size -1 -1 497 419
  option pixels
  box "Files Found", 1, 3 1 492 256
  button "Exit", 3, 414 390 75 25, ok cancel
  edit "", 5, 13 275 232 21, read autohs
  box "Search Directory", 2, 3 258 299 45
  button "Change", 6, 248 275 50 21
  box "Display Options", 7, 3 307 122 109
  check "Display .ini Files", 8, 8 332 100 20
  check "Display .mrc Files", 9, 8 358 100 20
  check "Display loaded files", 10, 8 384 118 20
  box "Start Search", 11, 133 307 170 109
  edit "2", 12, 139 322 34 21
  text "Search Depth", 13, 183 326 74 16
  button "Search!", 14, 243 391 51 20, default
  box "File Tools", 23, 305 258 190 80
  button "View File", 24, 314 279 53 20
  button "File Info", 25, 374 279 53 20
  button "Add Directory To Manager", 26, 323 305 154 24
  button "Load File", 27, 435 278 53 20
  box "Messages", 17, 306 338 188 40
  edit "Created By Crossfire39", 18, 311 353 178 21, read
  text "", 19, 252 239 194 16, right
  edit "50", 28, 139 347 38 21
  text "Max Files Shown", 29, 182 350 85 16
  combo 4, 9 16 481 222, size
  edit "", 30, 139 388 95 21
  text "In Filename (Optional)", 31, 139 371 123 16
  menu "File", 15
  item "Exit", 16, 15, cancel
  menu "Help", 20
  item "Instructions", 21, 20
  item "Credits", 22, 20
}

dialog sm_search_confirm {
  title "Warning"
  size -1 -1 261 144
  option pixels
  box "Error", 1, 6 1 248 104
  text "     The values that you set for depth and/or files displayed may cause some computer lag. To avoid this, select Cancel below, lower the values, narrow down the directory, and search again. If you wish to proceed with the search select Ignore below.", 2, 14 16 232 84
  button "Ignore", 3, 24 112 75 25, ok
  button "Cancel", 4, 151 112 75 25, default cancel
}

dialog sm_search_help {
  title "Search Instructions"
  size -1 -1 297 254
  option pixels
  box "Instructions", 1, 3 0 290 223
  button "Back", 2, 218 226 64 20, ok cancel
  text " When you start the search program, the defaults will be loaded. Path is the root directory the prgram will search. Deselecting Display .ini and Display .mrc will cause the program to not display the respective file type. Deselecting Display Loaded Files will cause the program to omit loaded files from the search. Search depth specifies how many subdirectories the engine will go through. Max files shown is a way to speed up the engine by limiting how many files it will search for. Once you decide on these values click the search button and your search will begin. If you wish to search for files with specific text in their filenames, put the components in the filename box. Once the search is complete, you can choose to view the files, view information about the file, load the file, or load the files directory in the manager. ", 3, 8 15 279 201
  link "Support Forum", 4, 11 225 101 20
}

on 1:dialog:sm_search:init:0:{
  /did -ra sm_search 5 $mircdir
  /did -c sm_search 8
  /did -c sm_search 9
  /did -c sm_search 10
}

;Closes open dialogs
on 1:dialog:sm_search:close:0:{
  if ( $dialog(sm_search_help) != $null ) { /dialog -x sm_search_help }
  if ( $dialog(sm_credits) != $null ) { /dialog -x sm_credits }
  if ( $dialog(sm_search_confirm) != $null ) { /dialog -x sm_search_confirm }
}

;Opens file directory browser
on 1:dialog:sm_search:sclick:6: /did -ra sm_search 5 $sdir($mircdir, Select a directory to search!)

;This part gathers inputed data and starts the search
on 1:dialog:sm_search:sclick:14:{
  ;Checks to see that everything has input
  if ( ($did(sm_search,8).state == 0) && ($did(sm_search,9).state == 0)) { /did -ra sm_search 18 Choose at least one type of file | /halt }
  if ( $did(sm_search,12).text < 0 ) { /did -ra sm_search 18 Depth must be greater than 0 | /halt }
  if ( $did(sm_search,5).text == $null) { /did -ra sm_search 18 Select a directory | /halt }
  if ( $did(sm_search,28).text == $null ) { /did -ra sm_search 18 Choose max files | /halt }
  if ( ($did(sm_search,28).text > 50) || ($did(sm_search,12).text > 10) ) { /dialog -vm sm_search_confirm sm_search_confirm | /halt }
  /Search
}

alias -l Search {
  /did -r sm_search 4
  /var %infile = * $+ $replace($did(sm_search,30).text,$chr(32),$chr(42))
  /var %ext = $iif($did(sm_search,8).state == 1,%infile $+ *.ini) $+ $iif(($did(sm_search,8).state == 1) && ($did(sm_search,9).state == 1),;) $+ $iif($did(sm_search,9).state == 1,%infile $+ *.mrc) 
  /var %x = $findfile($did(sm_search,5).text,%ext,0,$int($did(sm_search,12).text))
  /var %tot = $iif( %x > $did(sm_search,28).text,$did(sm_search,28).text, %x )
  %y = 1
  /var %total = %x
  /var %disp = 1
  while ( %y <= %x ) {
    /var %z = $findfile($did(sm_search,5).text,%ext,%y,$int($did(sm_search,12).text))
    /did -ra sm_search 18 $str(|,$calc(41/ %tot * %y ))
    if ( ($did(sm_search,10).state != 1) && ($script(%z) != $null)) { /inc %y | /dec %total | /dec %tot | /continue }
    /did -i sm_search 4 %disp %z
    /inc %disp 
    /inc %y
    $iif(%disp > $did(sm_search,28).text,/break)
  }
  /did -ra sm_search 18 Search completed
  /did -ra sm_search 19 Displaying $calc(%disp -1) of %total found files
}

;Opens the help dialog
on 1:dialog:sm_search:menu:21: /dialog -vm sm_search_help sm_search_help

;Allows you to view a file
on 1:dialog:sm_search:sclick:24:{
  if ( $did(sm_search,4).seltext == $null ) { /did -ra sm_search 18 Select a file! | /halt }
  /dialog -vm sm_view sm_view
  /LoadPreview $did(sm_search,4).seltext
  if ( $script($did(sm_search,4).seltext) ) { /did -c sm_view 7 $didwm(sm_view,7,$nopath($did(sm_search,4).seltext)) }
}

;Shows file information
on 1:dialog:sm_search:sclick:25:{
  if ( $did(sm_search,4).seltext == $null ) { /did -ra sm_search 18 Select a file! | /halt }
  /LoadViewerFileInfo $did(sm_search,4).seltext
}

;Adds directory to manager
on 1:dialog:sm_search:sclick:26:{
  /var %x = $did(sm_search,4).seltext
  if ( %x == $null ) { /did -ra sm_search 18 Select a file! | /halt }
  if ( $didwm(sm,17,$nofile(%x)) != 0 ) { /did -ra sm_search 18 Directory already added | /did -c sm 17 $didwm(sm,17,$nofile(%x)) | /halt }
  /did -ac sm 17 $nofile(%x)

}

;Loads the file
on 1:dialog:sm_search:sclick:27:{
  /var %x = $did(sm_search,4).seltext
  if ( %x == $null ) { /did -ra sm_search 18 Select a file! | /halt }
  if ( ($nopath(%x) == aliases.ini) || ($nopath(%x) == mirc.ini) || ($nopath(%x) == popups.ini) || ($nopath(%x) == perform.ini) || ($nopath(%x) == remote.ini) || ($nopath(%x) == servers.ini) ) { /did -ar sm_search 18 Mirc file, unable to load | /halt }
  if ( $script($nopath(%x)) ) { /did -ra sm_search 18 Script already loaded | /halt }
  /did -az sm 1 $nopath(%x)
  .load -rs $qt(%x)
  if ( $didwm(sm,2,$nopath(%x)) != 0 ) { /did -d sm 2 $didwm(sm,2,$nopath(%x)) }
  /Title
  /did -ra sm_search 18 Script loaded!
}

on 1:dialog:sm_search:menu:22: /dialog -vmr sm_credits sm_credits 

on 1:dialog:sm_search_help:sclick:4: run http://forum.swiftirc.net/viewtopic.php?p=61133 

on 1:dialog:sm_search_confirm:sclick:3: /Search

;##########################################################
;##                         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
}

;Alias used to unload scripts
alias -l UnloadScript {
  if ( $2- != $nopath($script)) { 
    if ( $didwm(sm,17,$nofile($script($2-))) != 0 ) { /did -a sm 2 $2- | /did -c sm 17 $v1 }
    else { /did -ac sm 17 $nofile($script($2-)) | /did -a sm 2 $2- }
    .unload -rs $qt($script($2-)) 
    /did -d sm 1 $1
  }
  else { /did -ar sm 11 Cannot unload 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 %y = 1
  var %x = $lines($1-)
  %x = $iif(%x > 500,500,%x)
  /var %indent = 0
  while ( %y <= %x) { 
    /var %z = $read($1-, nt, %y)
    if ( *.ini iswm $1- ) { %z = $deltok(%z,1,61) }
    if ((*}* iswm %z) && (*{* !iswm %z)) { /dec %indent 3 }
    /did -iz sm_view 3 %y $str($chr(160),%indent) %z
    if ((*{* iswm %z) && (*}* !iswm %z)) { /inc %indent 3 }
    /inc %y 
  }
  /dialog -t sm_view Script Preview - $nopath($1-)
  /did -ra sm_view 4 %x / $lines($1-)
  /did -ra sm_view 18 $1-

}

alias -l LoadViewerFileInfo {
  /dialog -vmr sm_view_info sm_view_info
  /dialog -t sm_view_info File Information - $nopath($1-)
  /did -ra sm_view_info 3 $nopath($1-)
  /did -ra sm_view_info 6 $nofile($1-)
  /did -ra sm_view_info 12 $asctime($file($qt($1-)).ctime,mmm-dd-yy h:nntt)
  /did -ra sm_view_info 2 $asctime($file($qt($1-)).mtime,mmm-dd-yy h:nntt)
  /did -ra sm_view_info 8 $lines($qt($1-))
  /did -ra sm_view_info 10 $round($calc($file($qt($1-)).size /1000),2) $+ KB
  $iif($script($nopath($1-)) != $null,/did -v sm_view_info 15)
}