on *:LOAD:/echo -a Write 4/DIR for more info.
alias dir {
  window -dokhe @Dir
  echo @Dir Êîìàíäè:
  echo @Dir -
  echo @Dir 4list - lists all files in $mircdirlog $+ .
  echo @Dir 4search <file> - makes a search
  echo @Dir 4run <file> - executes the file
  echo @Dir 4del <file> - delete
  echo @Dir 4rename <file> - rename
  echo @Dir -
}
on *:INPUT:*:{
  if ($1 == search) {
    if ($window(@Dir) == $null) { dir | halt }
    if ($2- == $null) { echo -a -> Usage: 4/search <word> | return }
    else {
      set %dir $mircdirlog
      set %duma $2-
      set %duma2 %duma $+ *
      set %number 0
      set %sfile $findfile($mircdirlog,%duma2,0)
      echo @Dir Results for " $+ 4 $+ %duma $+  $+ " in folder $mircdirlog
      echo @Dir -
      if ($findfile($mircdirlog,%duma2,1) == $null) { echo @Dir -> 4No files found. | echo @Dir - | echo @Dir End of search | halt }
      else {
        while (%number <= $calc(%sfile - 1)) {
          inc %number
          set %file $remove($findfile($mircdirlog,%duma2,%number),$mircdirlog,\)
          echo @Dir -> $+ 0 %number $+ . $+ 4 %file $+  $round($calc($file($mircdirlog\ $+ %file).size / 1024),1) KB
        }
        echo @Dir -
        echo @Dir End of search
      }
    }
  }
  if ($1 == list) {
    if ($window(@Dir) == $null) { dir | halt }
    echo @Dir Äèðåêòîðèÿ $mircdirlog
    echo @Dir -
    :start
    inc %proba
    set %nam $findfile($mircdirlog,*.*,0)
    if (%proba =< $calc(%nam + 1)) goto end
    set %file $remove($findfile($mircdirlog,*.*,%proba),$mircdirlog)
    echo @Dir %proba $+ . 4 $+ $remove($findfile($mircdirlog,*.*,%proba),$mircdirlog,\) 0 $round($calc($file($mircdirlog $+ %file).size / 1024),1) KB
    goto start
    :end
    echo @Dir -
    echo @Dir End of list
    unset %proba
  }
  if ($1 == run) {
    if ($window(@Dir) == $null) { dir | halt }
    if ($2- == $null) { echo -a -> Usage: 4/run <file> | return }
    else {
    if ($file($mircdirlog\ $+ $2-) == $null) { echo @Dir 4 $+ $2- $+  - no such file! | return }
      else {
        run $mircdirlog\ $+ $2-
      }
    }
  }
  if ($1 == del) {
    if ($window(@Dir) == $null) { dir | halt }
    if ($2- == $null) { echo -a -> Usage: 4/del <file> | return }
    else {
      if ($file($mircdirlog\ $+ $1-) == $null) { echo @Dir 4 $+ $2- $+  - no such file! | return }
      else {
        .remove $mircdirlog\ $+ $2-
        echo @Dir 4 $+ $2- $+  was deleted
      }
    }
  }
  if ($1 == rename) {
    if ($window(@Dir) == $null) { dir | halt }
    if ($2 == $null) { echo -a -> Usage: 4/rename <file> <new name> | return }
    if ($3 == $null) { echo -a -> Usage: 4/rename <file> <new name> | return }
    else {
      if ($file($mircdirlog\ $+ $2) == $null) { echo @Dir 4 $+ $2 $+  - no such file! | return }
      else {
        .rename $mircdirlog\ $+ $2 $mircdirlog\ $+ $3
        echo @Dir 4 $+ $2 $+  was renamed to 4 $+ $3 $+ 
      }
    }
  }
}
Published in: mIRC
Download

Related snippets