Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5914 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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?

Posted

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]

SaveAs.jpg

Posted

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!

Posted

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...

Posted

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.

Posted

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?

Posted

yes the script is working. Thanks for your help. However, I'm sure I had the script overwriting before.

JAG

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.