Loaded Scripts Information — File Browser

LoadedScriptsInformationv1.0 / LoadedScriptsInformationv1.0 / lsi.mrc

lsi.mrc — 9.03 KB — Download this file

;Loaded Scripts Information
; by MTec89 (mtec89net.com)
; load the script, and type /lsi or /lsi2 (lsi2 in the Scripts Menu of the /lsi dialog; "SInfo")
; Shows information about the loaded scripts, and has a list of loaded scripts.

dialog LSI {
  size -1 -1 465 242
  title "Loaded Scripts Information"
  list 1, 0 0 465 240, extsel size
  menu "File", 2
  item "Options", 3, 2
  item "Exit", 4, 2, ok
  menu "Script" 5
  item "Load" 6, 5
  item "Unload" 7, 5
  item "SInfo" 10, 5
  menu "Help", 8
  item "About", 9, 8
}
dialog lsio {
  title "Loaded Scripts Information: Options"
  size -1 -1 175 13
  option dbu
  text "Script Editor:", 1, 1 2 33 8
  edit "", 2, 35 1 106 10
  button "Browse", 3, 142 1 30 10
}
dialog lsia {
  title "Loaded Scripts Information: About"
  size -1 -1 120 37
  option dbu
  text "Loaded Scripts Information 8/04/04                Contact MTec89 irc.freenode.net #MTec89Net AIM: MTec89Net                                                  Yahoo: MTec89                                               MSN: mtec89@gmail.com", 1, 1 1 118 34
  button "ok", 2, 104 22 14 12, flat ok
}
on *:dialog:LSI:*:*: {
  if ($devent == init) {
    dll $scriptdirdll\mdx.dll SetMircVersion $version
    dll $scriptdirdll\mdx.dll MarkDialog $dname
    dll $scriptdirdll\mdx.dll SetControlMDX $dname 1 ListView report rowselect single grid > $scriptdirdll\views.mdx
    did -i $dname 1 1 headerdims 150 50 60 60 62 78
    did -i $dname 1 1 headertext File Name $chr(9) Lines $chr(9) Aliases $chr(9) Dialogs $chr(9) Variables $chr(9) Total KB
    var %lsi.num_scripts = $script(0),%i = 1,%g,%tfs
    var %talias = 0,%tdials = 0,%tvars = 0
    while (%i <= %lsi.num_scripts) {
      .write -c temp.txt
      set %alia 0
      set %dial 0
      var %lines = $lines($script(%i)),%fs = $file($script(%i)).size,%fn = $remove($script(%i),$mircdir)
      .filter -k %fn countparm
      did -i $dname 1 2 %fn $chr(9) %lines $chr(9) %alia $chr(9) %dial $chr(9) $lines(temp.txt) $chr(9) $round($calc(%fs / 1024),2)
      %talias = $calc(%talias + %alia)
      %tdials = $calc(%tdials + %dial)
      %tvars = $calc(%tvars + $lines(temp.txt))
      inc %tfs %fs
      inc %g %lines
      inc %i
    }
    did -a LSI 1 Totals: $script(0) $chr(9) %g $chr(9) %talias $chr(9) %tdials $chr(9) %tvars $chr(9) $round($calc(%tfs / 1024),2)
    .remove temp.txt
    unset %alia
    unset %dial
  }
  elseif ($devent == sclick) {
  }
  elseif ($devent == dclick) {
    if ($did == 1) {
      if ($gettok($gettok($did(LSI,1).seltext,1,9),6-,32) != Totals: $script(0)) {
        if (%lsi.s) { run %lsio.s $+(",$mircdir,$gettok($gettok($did(LSI,1).seltext,1,9),6-,32),") }
        else { lsio }
      }
    }
  }
  elseif ($devent == menu) {
    if ($did == 3) { lsio }
    elseif ($did == 6) { lsil }
    elseif ($did == 7) { lsiu }
    elseif ($did == 9) { lsia }
    elseif ($did == 10) { lsi2 }
  }
}
on *:dialog:LSIO:*:*: {
  if ($devent == init) { did -ra lsio 2 %lsi.s }
  elseif ($devent == edit) {
    if ($did == 2) { set %lsi.s $did(2).text }
  }
  elseif ($devent == sclick) {
    if ($did == 3) { set %lsi.s $+(",$sfile(C:\,Script Editor,Ok),") | did -ra lsio 3 %lsi.s }
  }
}
alias countparm {
  if ($gettok($1-,1,32) == alias) { inc %alia }
  if ($gettok($1-,1,32) == dialog) { inc %dial }
  if ($gettok($1-,0,37) > 1) {
    var %i = 2
    while (%i <= $gettok($1-,0,37)) {
      ; list all vars found in status.. <-- not a good idea..
      ;echo -s $gettok($gettok($gettok($gettok($1-,%i,37),1,32),1,44),1,41)
      if (!$read(temp.txt,w,$gettok($gettok($gettok($gettok($1-,%i,37),1,32),1,44),1,41))) { write temp.txt $gettok($gettok($gettok($gettok($1-,%i,37),1,32),1,44),1,41) }
      inc %i
    }
  }
}
alias lsi dialog -m lsi lsi
alias lsio dialog -m lsio lsio
alias lsiu { if ($gettok($gettok($did(LSI,1).seltext,1,9),6-,32) != Totals: $script(0)) { unload -rs $+(",$mircdir,$gettok($gettok($did(LSI,1).seltext,1,9),6-,32),") | dialog -x lsi | lsi } }
alias lsia dialog -m lsia lsia
alias lsil { load -rs $+(",$sfile($mircdir,Load Script,Load),") | dialog -x lsi | lsi }

; Next Code by Tye
alias lsi2 dialog -m sinfo sinfo
dialog SInfo {
  title "Script Information"
  size -1 -1 153 188
  option dbu
  list 1, 0 12 153 144, size
  combo 2, 0 0 152 50, size drop
  box "List", 3, 0 156 153 32
  check "Aliases", 4, 2 165 28 10
  check "Dialogs", 5, 31 165 28 10
  check "Events", 6, 60 165 28 10
  check "Menus", 7, 2 176 27 10
  check "Line numbers", 8, 88 165 42 10
}
on *:dialog:SInfo:*:*:{
  if ($devent == init) {
    var %i = 1
    while ($script(%i)) {
      did -a $dname 2 $nopath($v1)
      inc %i
    }
    did -c $dname 4,5,6,7,8
    dll $+(",$scriptdirdll\mdx.dll") SetMircVersion $version
    dll $+(",$scriptdirdll\mdx.dll") MarkDialog $dname
    dll $+(",$scriptdirdll\mdx.dll") SetControlMDX $dname 1 treeview haslines hasbuttons linesatroot showsel > $scriptdirdll\views.mdx
  }
  elseif ($devent == sclick) {
    if ($did == 2) {
      did -r $dname 1
      did -i $dname 1 1 cb root
      var %file = $+(",$script($did(2).sel),"), %d, %c, %l
      if ($fopen(SInfo)) { .fclose SInfo }
      .fopen SInfo %file
      if (!$ferr) {
        if ($did(4).state) {
          did -a $dname 1 Aliases
          did -i $dname 1 1 cb last
          %l = 1
          while (!$feof) {
            var %read = $fread(SInfo), %c = 0
            if (alias ?* $chr(123) $+ * iswm %read) {
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $gettok(%read,2,32)
              if ($count(%read,$chr(123)) == $count(%read,$chr(125))) { did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $mid($gettok(%read,3-,32),2,$calc($len($gettok(%read,3-,32)) - 2)) }
              else { %d = 1 }
            }
            elseif (alias ?* iswm %read) && ($chr(123) !isin %read) {
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $gettok(%read,2,32)
              did -i $dname 1 1 cb last
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $gettok(%read,3-,32)
              did -i $dname 1 1 cb up
            }
            elseif (%d) {
              if (%read == $chr(125)) { %d = 0 }
              else {
                did -i $dname 1 1 cb last
                did -a $dname 1 + $iif($did(8).state,$+(%l,.)) %read
                did -i $dname 1 1 cb up
              }
            }
            inc %l
          }
        }
        did -i $dname 1 1 cb up
        did -i $dname 1 1 cb up
        .fseek SInfo 0
        if ($did(5).state) {
          did -a $dname 1 + Dialogs
          did -i $dname 1 1 cb last
          %l = 1
          while (!$feof) {
            var %read = $fread(SInfo)
            if (dialog ?* $chr(123) iswm %read) {
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $gettok(%read,2,32)
              %d = 1
            }
            elseif (%d) {
              if (%read == $chr(125)) { %d = 0 }
              else {
                did -i $dname 1 1 cb last
                did -a $dname 1 + $iif($did(8).state,$+(%l,.)) %read
                did -i $dname 1 1 cb up
              }
            }
            inc %l
          }
        }
        did -i $dname 1 1 cb up
        did -i $dname 1 1 cb up
        .fseek SInfo 0
        if ($did(6).state) {
          did -a $dname 1 + Events
          did -i $dname 1 1 cb last
          %l = 1
          while (!$feof) {
            var %read = $fread(SInfo)
            if (on ?*:?*:* iswm %read) {
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) on $gettok(%read,2,58)
              did -i $dname 1 1 cb last
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) %read
              did -i $dname 1 1 cb up
              if ($count(%read,$chr(123)) != $count(%read,$chr(125))) { %d = 1 }
            }
            elseif (%d) {
              if (%read == $chr(125)) { %d = 0 }
              else {
                did -i $dname 1 1 cb last
                did -a $dname 1 + $iif($did(8).state,$+(%l,.)) %read
                did -i $dname 1 1 cb up
              }
            }
            inc %l
          }
        }
        did -i $dname 1 1 cb up
        did -i $dname 1 1 cb up
        .fseek SInfo 0
        if ($did(7).state) {
          did -a $dname 1 + Menus
          did -i $dname 1 1 cb last
          %l = 1
          while (!$feof) {
            var %read = $fread(SInfo)
            if (menu ?* $chr(123) iswm %read) {
              did -a $dname 1 + $iif($did(8).state,$+(%l,.)) $gettok(%read,2,32)
              did -i $dname 1 1 cb last
              %d = 1
            }
            elseif (%d) {
              if (%read == $chr(125)) { %d = 0 }
              else {
                did -i $dname 1 1 cb last
                did -a $dname 1 + $iif($did(8).state,$+(%l,.)) %read
                did -i $dname 1 1 cb up
              }
            }
            inc %l
          }
        }
        did -i $dname 1 1 cb up
        did -i $dname 1 1 cb up
        if ($fopen(SInfo)) { .fclose SInfo }
      }
    }
  }
}
;[EoF]