tglogo.png

Downloading File

Filename: Script Backup
alias script.backup {
  set %Directory $sdir(C,Please locate your scripts folder)
  var %x = 1
  .dialog -md Backup.Dialog Backup.Dialog
  while ( $findfile(%Directory,.mrc,%x) != $null ) {
    .did -a Backup.Dialog 1 $nopath($findfile(%Directory,.mrc,%x))
    .inc %x
  }
}
menu menubar,channel,status {
  Backup Scripts{ script.backup }
}
dialog Backup.Dialog {
  title mIRC Script Backup
  size -1 -1 167 247
  option pixels
  list 1, 7 7 154 171, size
  text These files will be backed up if you wish to continue., 2, 20 181 128 30
  button OK, 3, 25 217 55 25, ok
  button Cancel, 4, 86 217 55 25, cancel
}
on dialogBackup.Dialogsclick4{ .unset %Directory }
on dialogBackup.Dialogsclick3{
  var %Script.Backup = $input(Are you sure you wish to backup these files $crlf $crlf $chr(40) $+ Note All existing files will be overwritten. $+ $chr(41) $crlf,40,Confirmation)
  if (%Script.Backup = $yes) {
    if ($exists($mircdirBackups) == $false) { .mkdir Backups }
  .write $($+(,$mircdirBackupsBackupLog.txt,)) $crlf $crlf $chr(91) $+ Script Backup For $asctime(dddd $+ $chr(44) mmmm d $+ $chr(44) yyyy) $+ . $chr(124) $asctime(hnnss TT) $+ $chr(93) }
  .echo -s 12 Now backing up your scripts...
  var %Dir = %Directory
  .unset %Directory
  var %x = 1
  while ( $findfile(%Dir,.mrc,%x) != $null ) {
    .write $($+(,$mircdirBackupsBackupLog.txt,)) Backed up $nopath($findfile(%Dir,.mrc,%x)) $+ . ( $+ $findfile(%Dir,.mrc,%x) $+ )
    .copy -o $($+(,$findfile(%Dir,.mrc,%x),)) $($+(,$mircdirBackups $+ $nopath($findfile(%Dir,.mrc,%x)),))
    .echo -s 3 $findfile(%Dir,.mrc,%x) has been backed up successfully!
    .inc %x
    else { .echo -s 4 An unexpected error occurred while backing up $findfile(%Dir,.mrc,%x) $+ !  .write $($+(,$mircdirBackupsBackupLog.txt,)) Could not copy $nopath($findfile(%Dir,.mrc,%x)) $+ . ( $+ $findfile(%Dir,.mrc,%x) $+ ) }
  }
  .echo -s 7 All your scripts have been backed up!
}

Related Files

by jonesy44
by Lindrian

Please note that on our website we use cookies necessary for the functioning of our website, cookies that optimize the performance. To learn more about our cookies, how we use them and their benefits, please read our Cookie Policy.
I Understand