Backup Current Part

From Macros Wiki
Jump to: navigation, search
!    backup the current part using
!    create a new filename based on current filename
a1$ = "This macro will make a backup copy of the current"
a2$ = "part by saving it under a a filename which is the same"
a3$ = "as the current filename, but with '_backup'added to it"
message "%a1$\n%a2$\n%a3$"
check part_open, "You must have a part open to run this macro"
get_part_data part_name, pname$
get_part_data part_file, pfile$
!     remove the /vnc film the end of the filename
!     then add "_backup.vnc" to it
a$="OK to save current part as\n%f$"
yesno a$, iyesno
if iyesno=0 then stop "Backup not created"
message "Backup was created"
save_part_as f$
!    save the current part as the original filename
!    if we dont do this now, using file save
!    will overwrite the backup file we just saved
save_part_as pfile$
stop "Finished"