john9210 Posted September 10, 2008 Posted September 10, 2008 I use the script step Save a Copy as to create backups of my files. For example, I use Save A Copy As["$filename",compacted]. $filename is a script variable that creates the file name in the format I want it. However, the script step places the backup in the parent directory (where the parent FM file is) and I would like to save to a sub-directory of the parent. How can I do this?
Josh Ormond Posted September 10, 2008 Posted September 10, 2008 In the "Specify Output File", you need to Add File and input the path you want. If you set the variable to the path you can just use the variable. Example: Set Variable [$SaveAs; "file:FolderName/$Test"] Save a Copy as ["$SaveAs"; copy]
john9210 Posted September 10, 2008 Author Posted September 10, 2008 Josh, I created a script to save to the sub-directory "Backup" using a relative path. I want it to create a file with the same name as the parent file, with the word backup added. It script saves to the proper directory, but it creates a generic file instead of a FM file. Also, it names the file $filename. I’ve tried all sorts of variations but can’t get it to work. Here’s what I have. Set Variable [$filename; Value:Get(FileName)&”Backup.fp7”] Set Variable [$SaveAs; Value”file:backup/$filename] Save a Copy as [“$SaveAs”;compacted] By the way, what is the script variable $Test in your example script? Also, It’s interesting that in “Specify Output File” the path is specified with slashes and not back slashes!
_henry_ Posted September 10, 2008 Posted September 10, 2008 Hi John, ... Set Variable [$filename; Value:Get(FileName)&”Backup.fp7”] Set Variable [$SaveAs; Value”file:backup/$filename] Save a Copy as [“$SaveAs”;compacted] ... try to change $SaveAs to this: "file:backup/" [b]&[/b] $filename e.g from Windows based: "filewin:/c:/backup/" & $filename I think you missed the "&" sign. Hope this helps...
john9210 Posted September 11, 2008 Author Posted September 11, 2008 I’m finding it very difficult to use the Save a Copy as script step. This simple script doesn’t work. What gives? Set Variable [$filename; Value:Get( FileName)&”.fp7”] Save a Copy as [ $filename; copy] I get the error message that the file can’t be created. However the debugger shows $filename is getting the correct name and appends the fp7. It becomes StarterTemplate3.fp7. It should overwrite the parent file since it has the same name but I'm getting the error message.
comment Posted September 11, 2008 Posted September 11, 2008 A file will not overwrite itself. Not even when you do Save a Copy As… manually. That's a good thing.
_henry_ Posted September 11, 2008 Posted September 11, 2008 I agreed with Comment regarding overwriting. At first, I thought you want to make a backup copy? Well, is it working for you about the script that I mentioned to you?
john9210 Posted September 11, 2008 Author Posted September 11, 2008 yes the script is working. Thanks for your help. However, I'm sure I had the script overwriting before. JAG
Raybaudi Posted September 11, 2008 Posted September 11, 2008 You can overwrite a file, but not the current one ( which is opened ), neither other opened files.
Josh Ormond Posted September 15, 2008 Posted September 15, 2008 Overwriting the current, open file??? That is the idea that makes up many a fears of developers of any software. I used to have a program that allowed you to completely overwrite the current/open file. After spending 6 weeks developing a solution, I accidentially pressed a shortcut and overwrote my solution with a copy of the Test file I was testing a caluclation with. No doubt, my own foolish-ness, hadn't made a backup copy yet. However, most programs would have stopped you and said no... Many, many, many tears. Not to mention the fits caused with overwriting data that is actively being accessed. What a mess.
Recommended Posts
This topic is 5914 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now