Backup Current Part: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
{| | {| | ||
|- | |- | ||
|! backup the current part using | |! backup the current part using | ||
|- | |- | ||
|! create a new filename based on current filename | |! create a new filename based on current filename | ||
|- | |- | ||
| | | | ||
| Line 57: | Line 57: | ||
| | | | ||
|- | |- | ||
|! save the current part as the original filename | |! save the current part as the original filename | ||
|- | |- | ||
|! if we dont do this now, using file save | |! if we dont do this now, using file save | ||
|- | |- | ||
|! will overwrite the backup file we just saved | |! will overwrite the backup file we just saved | ||
|- | |- | ||
| | | | ||
Latest revision as of 23:39, 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" |