Copy link to clipboard
Copied
I currently have a working script for SaveDocsAsPDF_Presets and it works great, but now that we can Save a Copy instead of Save As, I was hoping someone could modify my script to be Save a Copy instead of Save As? I don't know how to write scripts and my feeble attempt to modify it has resulted in no results...any help apprecitated!
Here is my current script:
var w = new Window("dialog", "Choose a Preset");
var dropdownlist = w.add("dropdownlist", undefined, app.PDFPresetsList);
dropdownlist.preferredSize.width = 200;
dropdownlist.selection = 0;
var choice = dropdownlist.selection;
dropdownlist.onChange = function () {
choice = dropdownlist.selection;
};
var button = w.add("button", undefined, "OK");
button.onClick = function () {
saveDocsAsPDF(choice);
w.close();
};
w.show();
function saveDocsAsPDF(choice) {
// original SaveDocsAsPDF script
try {
if (app.documents.length > 0 ) {
var destFolder = null;
destFolder = Folder.selectDialog('Select folder for PDF files.', '~');
if (destFolder != null) {
var options, i, sourceDoc, targetFile;
options = getOptions();
for ( i = 0; i < app.documents.length; i++ ) {
sourceDoc = app.documents[i];
targetFile = getTargetFile(sourceDoc.name, '.pdf', destFolder);
sourceDoc.saveAs( targetFile, options );
}
alert('Documents saved as PDF');
}
} else {
throw new Error('There are no document open!');
}
} catch(e) {
alert( e.message, "Script Alert", true);
}
function getOptions() {
var options = new PDFSaveOptions();
options.pDFPreset = choice;
return options;
}
function getTargetFile(docName, ext, destFolder) {
var newName = "";
if (docName.indexOf('.') < 0) {
newName = docName + ext;
} else {
var dot = docName.lastIndexOf('.');
newName += docName.substring(0, dot);
newName += ext;
}
var myFile = new File( destFolder + '/' + newName );
if (myFile.open("w")) {
myFile.close();
}
else {
throw new Error('Access is denied');
}
return myFile;
}
}
[MOVED TO THE ILLUSTRATOR DISCUSSIONS]
Copy link to clipboard
Copied
What app does you use?
Copy link to clipboard
Copied
Not sure how my post got in the Acrobat community, meant to be in the Illustrator help as this is an Illustrator script. I will move it there.
Copy link to clipboard
Copied
What do you mean by "save a copy"?
In Acrobat, it's a misnamed function used only to disable Extended Rights for Reader.
Copy link to clipboard
Copied
Not sure how my post got in the Acrobat community, meant to be in the Illustrator help as this is an Illustrator script. I will move it there.
Copy link to clipboard
Copied
[MOVED TO THE ILLUSTRATOR DISCUSSIONS]