Copy link to clipboard
Copied
Coming along a problem I wrote this simple test:
#target framemaker
var backupFolder;
backupFolder = new Folder ("E:\\_DDDprojects\\FM-JsxLib\\Docu" + "\\_Backups1");
backupFolder = new Folder ("/e/DDDprojects/FM-JsxLib/Docu" + "/_Backups2");
Running in ESTK with an FM document open:
Selected target is ESTK CC :
Result: /e/DDDprojects/FM-JsxLib/Docu/_Backups1
Result: /e/DDDprojects/FM-JsxLib/Docu/_Backups2
Selected target is FrameMaker 15
Result: /e/DDDprojects/FM-JsxLib/Docu/_Backups2
In both scenarios no folder is created!
I do not get an error from the New command (backupFolder.error is a blank string)
Hi Klaus,
you have only created a Folder object, but not a folder.
To create the folder:
if (!backupFolder.exists){backupFolder.create()}
Have a nice day
Copy link to clipboard
Copied
Hi Klaus,
you have only created a Folder object, but not a folder.
To create the folder:
if (!backupFolder.exists){backupFolder.create()}
Have a nice day
Copy link to clipboard
Copied
Thanks, Klaus, for this enlightment!
But, why does Rick's code (part of the event script here only) work?
CP_BA.backupOnSave = function (sparam) {
var backupFolder, file;
backupFolder = new Folder ("C:\\DATA\\Scripts\\_Backups"); // Target folder for backups.
file = new File (sparam); // Make a file object for the document that was just saved.
file.copy (new File (backupFolder + "\\" + file.name)); // Copy the file to the backup folder.
};
Copy link to clipboard
Copied
Hi Klaus,
I will have to look at my code, but I may have made the assumption that the folder already exists.
Rick