Backup Current Part: Difference between revisions

From Macros Wiki
Jump to navigationJump to search
ConnerO (talk | contribs)
No edit summary
ConnerO (talk | contribs)
No edit summary
Line 29: Line 29:
| 
| 
|-
|-
|! remove the /vnc film the end of the filename
|!     remove the /vnc film the end of the filename
|-
|-
|! then add "_backup.vnc" to it
|!     then add "_backup.vnc" to it
|-
|-
| 
| 

Revision as of 23:30, 28 July 2010

! 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
 
ilen=len(pfile$)
f$=left$(pfile$,ilen-4)+"_backup.vnc"
 
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"