Backup Current Part: Difference between revisions

From Macros Wiki
Jump to navigationJump to search
ConnerO (talk | contribs)
New page: {| |- |! 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...
 
ConnerO (talk | contribs)
No edit summary
Line 5: Line 5:
|! create a new filename based on current filename
|! create a new filename based on current filename
|-
|-
|
| 
|-
|-
|a1$ = "This macro will make a backup copy of the current"
|a1$ = "This macro will make a backup copy of the current"
Line 13: Line 13:
|a3$ = "as the current filename, but with '_backup'added to it"
|a3$ = "as the current filename, but with '_backup'added to it"
|-
|-
|
| 
|-
|-
|message "%a1$\n%a2$\n%a3$"
|message "%a1$\n%a2$\n%a3$"
|-
|-
|
| 
|-
|-
|check part_open, "You must have a part open to run this macro"
|check part_open, "You must have a part open to run this macro"
|-
|-
|
| 
|-
|-
|get_part_data part_name, pname$
|get_part_data part_name, pname$
Line 27: Line 27:
|get_part_data part_file, pfile$
|get_part_data part_file, pfile$
|-
|-
|
| 
|-
|-
|!  remove the /vnc film the end of the filename
|!  remove the /vnc film the end of the filename
Line 33: Line 33:
|!  then add "_backup.vnc" to it
|!  then add "_backup.vnc" to it
|-
|-
|
| 
|-
|-
|ilen=len(pfile$)
|ilen=len(pfile$)
Line 39: Line 39:
|f$=left$(pfile$,ilen-4)+"_backup.vnc"
|f$=left$(pfile$,ilen-4)+"_backup.vnc"
|-
|-
|
| 
|-
|-
|a$="OK to save current part as\n%f$"
|a$="OK to save current part as\n%f$"
Line 47: Line 47:
|if iyesno=0 then stop "Backup not created"
|if iyesno=0 then stop "Backup not created"
|-
|-
|
| 
|-
|-
|message "Backup was created"
|message "Backup was created"
|-
|-
|
| 
|-
|-
|save_part_as f$
|save_part_as f$
|-
|-
|
| 
|-
|-
|!  save the current part as the original filename
|!  save the current part as the original filename
Line 63: Line 63:
|!  will overwrite the backup file we just saved
|!  will overwrite the backup file we just saved
|-
|-
|
| 
|-
|-
|save_part_as pfile$
|save_part_as pfile$
|-
|-
|
| 
|-
|-
|stop "Finished"
|stop "Finished"
|-
|-
|}
|}

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"