Hi everyone
I`m looking for how to make "Save as a copy" script.
All variants that I ever met (scripting guide or examples from the internet), were based on copying existing file.
And they doesn`t suit.
Why "Save as a copy ?
Because you can save you file to different directory (for example dropbox),
and your original file with undo options will stay opened (unlike the "Increment and Save").
You can feed the command name into this....
This is not 100 percent reliable, if you do a search here or aeenhancers, but does the job in most instances...
function exectuteCommandID(theCommand){
app.executeCommand(app.findMenuCommandId(theComma nd));
}
executeCommandID("Save A Copy or whatever is the menu command exactly.");
If you look at the scripting guide, you only have access to save() and saveWithDialog(). Therefore the code below works the same as the save as command.
However then your current project is this new saved file. So no joy.
var f = new File("C:/Users/Alan/Desktop/Noel Kealahan/copy.aep");
app.project.save(f);
You could lay out the functionality of your script like this.
1.Save current project and store it''s path in a var.
2.Execute save() to a custom path
3.File open the project stored in the var.
Of course the custom path would overwrite that file then each time.
Some of my projects are saving a bit long... about 5-7 minutes, so opening themselves should take 5-7 minutes too.
I thought I can do this in the background..
Oh, can I just save original file and copy it to custom path via script?
I found copy() function but I didn`t get how to use it exactly.
File.copy (target)
Yep that would work... excuse syntax errors below.
Keep and eye on URI notation too....
if(app.project.file){
save();
var target = new File([path to dropbox etc])
var thisFile = new File (app.project.name); // (of fsname - look it up)
thisFile.copy(target);
}
I'm not sure if it would overwrite the copied file each time .
That's great, oh yes I forgot the app.project.save();
There is no need for the [ ] in var target = new File(["C:/Users/admin/Dropbox/copy.aep"]) also.
if(app.project.file){
app.project.save();
var target = new File("C:/Users/Alan/Desktop/Noel Kealahan/copy.aep")
var thisFile = new File (app.project.file.fsName); // (of fsname - look it up)
if(target.exists){
//put stuff in here to increment file name using regex, perhaps
//or save the file elsewhere.
}
else{
thisFile.copy(target);
}
alert(app.project.file.fsName)
}
North America
Europe, Middle East and Africa
Asia Pacific