I have a document open in FrameMaker. I want to save a copy of the document, while leaving the current document open. So, instead of Save As, I want to do Save a Copy. Has anyone done this with the FDK or ExtendScript and will share some code.
I see some FDK options that may relate to this: FS_RetainNameStripe, FS_SaveAsModeName, FS_SaveMode. I can play around with these but was hoping someone already figured this out. Thanks in advance.
Is this possible in the UI? I don't think it is, and therefore suspect that the API has no direct route. But I could be wrong. Have you considered creating a new doc from the original doc, using it as a template? I think you can do it with this parameter and the Open() method:
Then you could save it and you would have a copy. But maybe this won't work if the template doc is already open.
Also, I'm not clear why a Save As and then reopen the original doc is not an option.
Hope this helps.
Thanks for the reply Russ. Here is my thinking based on a project I am working on.
I have an XML document open in FrameMaker that the user may have made changes to.
They want to run a script that is going to save and transform the document and produce some output.
However, they may not want the changes to the currently open XML file saved.
So, I thought if I could save a copy of the current document, it could kick off my transform with the copy while leaving the current document open and "dirty" in case they don't want to save the changes.
I am probably making things more complicated than they should be, but to be able to programmatically Save A Copy without saving the current document might be useful.
Interesting challenge! So my idea is useless, because the copy on disk is useless. The only thought that quickly comes to mind is to have a template doc, where you copy the main doc content into it and then do a Save As with the template. This could be done with a hidden doc, as you well know. That's the best I can come up with at the moment.
if this copy is in the same folder, I would just make a simple copy.
var goDoc = app.ActiveDoc; var sFile = goDoc.Name.split("\\").pop() var sPath = goDoc.Name.split("\\"); sPath.pop(); var sNewFile = sPath.join("\\") + "\\" +"~~" + sFile; // or just a different appendix var oFile = new File(goDoc.Name); oFile.copy(sNewFile);
If it should be stored in a different folder, then open this new file with FrameMaker, save it in a different folder and delete the "~~"-file.
Except that I want the new copy to have the current content of the active file, not the last saved content.