Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

How to save a copy of file? (need simple javascript)

$
0
0

I am noob, so need a Javascript script/install for InDesign CC,  that runs automatically when any file is opened, and saves a copy of the document to a specific folder automatically, with current time (i.e. "c:/folder/filename_COPY_6_MAY_2014_23_59_59").

is this code right for this job?:

var dmd = app.activeDocument;
var oldDocName = dmd.name;
//make new file
var newDocName = oldDocName.substring(0,oldDocName.length-5); //removes ".indd"
var dd = new Date;
var NewFile = new File("/c/backups_folder/" + newDocName + dd.getDate() + "_" + dd.getMonth() +  "_" + dd.getHours() + "-" + dd.getMinutes() + "-" + dd.getSeconds() +".indd");
//copy
oldDocName.copy(NewFile);

Viewing all articles
Browse latest Browse all 15932

Trending Articles