Script Backup

By Akishoot on Sep 13, 2008

How to use: Right-click on a channel or status window, or go to your menubar and select "Backup Scripts".

This is a fairly simple script, and its been made probably a hundred times before, but here's my version of it.

It saves all the scripts (.mrc) found in the folder you select to a folder named "Backups" in your mIRC directory.

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 *:dialog:Backup.Dialog:sclick:4:{ .unset %Directory }
on *:dialog:Backup.Dialog:sclick:3:{
  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(h:nn:ss 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!
}

Comments

Sign in to comment.
EL   -  Sep 13, 2008

Why not save everything or pick and choose what get saved seems more useful that way.Nice tho and i have nt seen one of these till now cool tho i ll have to test it sooner or later.`-.-´

 Respond  
Renegade   -  Sep 13, 2008

Another unique idea well excecuted :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.