Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Save a Copy as PDF with Presets for Multiple Open Tabs Script

Participant ,
Jan 25, 2024 Jan 25, 2024

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;
}
}

535
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 30, 2024 Jan 30, 2024

[MOVED TO THE ILLUSTRATOR DISCUSSIONS]

Translate
Adobe
Community Expert ,
Jan 25, 2024 Jan 25, 2024

What app does you use?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2024 Jan 29, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2024 Jan 25, 2024

What do you mean by "save a copy"?

In Acrobat, it's a misnamed function used only to disable Extended Rights for Reader.


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2024 Jan 29, 2024

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2024 Jan 30, 2024
LATEST

[MOVED TO THE ILLUSTRATOR DISCUSSIONS]


Acrobate du PDF, InDesigner et Photoshopographe
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines