September 10, 200817 yr 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?
September 10, 200817 yr 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]
September 10, 200817 yr Author 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!
September 10, 200817 yr 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...
September 11, 200817 yr Author 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.
September 11, 200817 yr A file will not overwrite itself. Not even when you do Save a Copy As… manually. That's a good thing.
September 11, 200817 yr 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?
September 11, 200817 yr Author yes the script is working. Thanks for your help. However, I'm sure I had the script overwriting before. JAG
September 11, 200817 yr You can overwrite a file, but not the current one ( which is opened ), neither other opened files.
September 15, 200817 yr 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.
Create an account or sign in to comment