Scripting Issue on MacOS Monterey
We had this script for Illustrator that will export PDF and images with predefined presets. This was working until some of our team upgraded their macOS to Monterey.
When they tried to run the script it will create a PDF and images with different file names, we are expecting that it will have the same file name from the AI file.
EXPECTED RESULT:
AI File: 02020-MVP-3.ai
Exported Files:
- 0202-MVP-3-THUMBNAIL.png
- 0202-MVP-3-FULL.png
- 0202-MVP-3.pdf
ACTUAL RESULT:
AI File: 02020-MVP-3.ai
Exported Files:
- ai1655486566390202-MVP-3-THUMBNAIL.png
- ai1655486566390202-MVP-3-FULL.png
- ai165548656639_0202-MVP-3.pdf
Operating System: MacOS Monterey 12.4
Adobe Illustrator: Adobe Illustrator 2022
Object Reference Documentation used in the script:
Document.name
https://ai-scripting.docsforadobe.dev/jsobjref/Document.html#document-name
=============== START: SCRIPT =====================
var docRef = app.activeDocument;
var originalFile = docRef.path.fsName + '/' + docRef.name;
with (docRef) {
// ISSUE: docRef.name returns extra characters in MacOS Monterey
var mailingNumber = name.replace('.ai', '');
var directory = path.fsName + '/';
for (var i = 0; i < artboards.length; i++) {
artboards.setActiveArtboardIndex(i);
var type = ExportType.PNG24;
var exportOptions = new ExportOptionsPNG24();
exportOptions.artBoardClipping = true;
exportOptions.transparency = false;
var thumbSpec = new File(
directory + mailingNumber + '-' + artboards[i].name + '-THUMBNAIL'
);
exportOptions.horizontalScale = 75.75757576;
exportOptions.verticalScale = 75.75757576;
exportFile(thumbSpec, type, exportOptions);
var fullSpec = new File(
directory + mailingNumber + '-' + artboards[i].name + '-FULL'
);
exportOptions.horizontalScale = 176.76767677;
exportOptions.verticalScale = 176.76767677;
exportFile(fullSpec, type, exportOptions);
}
var pdfOptions = new PDFSaveOptions();
pdfOptions.pDFPreset = "MVP Mailhouse High Quality Print";
pdfOptions.compatibility = PDFCompatibility.ACROBAT8;
pdfOptions.colorConversionID = ColorConversion.None;
var saveAsPath = new File(directory + mailingNumber + '.pdf');
saveAs(saveAsPath, pdfOptions);
close();
}
app.open(new File(originalFile));
=============== END: SCRIPT =====================
-
Vincent Panugaling commented
Hi there, does anyone experienced this?