Copy link to clipboard
Copied
I'm encountering a problem when attempting to retrieve a list of PDF preset names in both AppleScript and JavaScript. Here are the steps I'm performing:
1) Launch Illustrator
2) Run the following AppleScript:
tell application "Adobe Illustrator"
PDF presets
end tell
or JavaScript:
app.PDFPresetsList;
When I run the AppleScript, I receive an error: "Adobe Illustrator got an error: an Illustrator error occurred: 1128353350 ('FNAC')" number 1200. (Sometimes, 'ACVI' is listed instead of 'FNAC'.)
When I run the JavaScript, I receive: "Result: undefined"
If I retrieve Illustrator's properties via AppleScript, I can see that the PDF presets property appears as 'missing value'.
The only workaround I've found is to manually go to Illustrator and choose "Edit > Adobe PDF Presets", and then immediately click "OK" to close the window. Whatever this does seems to fix the problem, and if I run the scripts again, they produce the correct results until Illustrator is relaunched, at which time the problem begins again. I'm wondering if anyone else is experiencing this, and if anyone has come up with any other workarounds, preferably one that doesn't require manual work.
Much appreciated.
-Ben
Copy link to clipboard
Copied
Can you explain this part?
bwaldie wrote:
1) Launch Illustrator
2) [...] JavaScript:
app.PDFPresetsList;
When I run the JavaScript, I receive: "Result: undefined"
Do you mean you actually run a Javascript, containing just this single "command"? "Command", between quotes, because it's not a real command. It's just a property name; and "executing a property name" wouldn't do anything useful; hence, I'm a bit mystified by your insistence something seems to happen.
Copy link to clipboard
Copied
Yeah. All I want is to retrieve a list of PDF preset names, via the PDFPresetsList application property. The problem is that the property's value is always undefined until I manually go to View > Adobe PDF Presets..., and close the window. The result I mentioned are what I see in the JavaScript console in Adobe's ExtendScript Toolkit. When I attempt to get the property via AppleScript, I don't get an undefined result, I get an error 1200. Once I open and close the Adobe PDF Presets window in Illustrator, the property value is retrieved as expected.
Copy link to clipboard
Copied
Here you go:
tell application "Adobe Illustrator"
set presetNames to PDF presets
end tell
Copy link to clipboard
Copied
JaisanM wrote:
Here you go:
tell application "Adobe Illustrator"
set presetNames to PDF presets
end tell
Yep, that's the code I'm trying in AppleScript, and it's failing until I manually open the PDF Presets window and close it again. Appreciate the suggestion, though.
Regards,
-Ben
Copy link to clipboard
Copied
Hmm that is strange.
I just tested that with Mac OS 10.6.6 on CS5 (15.0.1), it works fine...
You may want to relaunch your illustrator and try with the same script again.
JaisanM
Copy link to clipboard
Copied
Yeah, I've tried relaunching, and, unfortunately, it presents the same issue. I've even tried clearing my presets and starting fresh, and that didn't work either, I'm afraid.
I've also had some clients (who I've delivered scripts to) report encountering the same error. It's weird. The script works just fine once the PDF presets window is opened and then closed. But, once I relaunch Illustrator, the problem begins again every time. If I can't identify a workaround, I may have to resort to some GUI scripting.
Thanks again for your suggestions.
-Ben
Copy link to clipboard
Copied
Both Ben's scripts work fine here so I don't think the issue is with either the language or the given syntax but his install… There are no script options within the app that are going to update this list for you…
Copy link to clipboard
Copied
Yes, perhaps. Thanks for confirming everything is working on your end. I will try re-installing to see if it resolves the problem. Perhaps it has something to do with me having multiple versions of CS on my machine too.
-Ben
Copy link to clipboard
Copied
These options are available to the suite and should be located in…
Copy link to clipboard
Copied
I did try clearing that folder of options and starting fresh, but it didn't resolve the issue. I'll check to see how the other apps behave, and will try to reinstall when I get the chance to see if that resolves things. Thanks again.
-Ben
Copy link to clipboard
Copied
Did you ever find a fix? I'm ecountering the same thing when trying to capture PDFPresetsList in an Extension... only workaround is to open and close the Adobe PDF Presets window.
Copy link to clipboard
Copied
Never did identify a resolution. I still haven't reinstalled Illustrator yet, however, to see if that would fix the problem. And, haven't tested with CS5.5 yet. Sorry.
-Ben
Copy link to clipboard
Copied
This works with a fresh restart of AI
#target illustrator
var textFile = File('~/Desktop/PDF Presets List.txt');
var myList = app.pDFPresetsList;
//alert ("PDF Presets List" + myList);
var appText = '';
for (var i = 0; i < myList.length; i++)
{
appText += myList + '\r';
}
textFile.open('e');
textFile.write(appText);
textFile.close();
Or to read it in AI
#target illustrator
var myList = app.pDFPresetsList;
var appText = '';
for (var i = 0; i < myList.length; i++)
{
appText += myList + '\r';
}
var docRef = documents.add();
var textRef = docRef.textFrames.add();
textRef.contents = appText;
textRef.top = 700;
textRef.left = 100;
Copy link to clipboard
Copied
Doesn't work for me. The first time I run it from the ExtendScript Toolkit, I get an error on the line:
var myList = app.pDFPresetsList;
An Illustrator error occurred: 1230390081 ('ACVI')
If I stop it and run it again, I get a different error on the same line.
An Illustrator error occurred: 1128353350 ('FNAC')
This second error continues to occur for subsequent runs.
-Ben
Copy link to clipboard
Copied
When I run the script (either from the ESTK or within AI) it gives me a combined list from two different sources. The first is the list of the suite installed joboptions which are located in OS/HD/Library/Application Support/Adobe/Adobe PDF/Settings like this
The other joboptions shown are the user defined ones from <your account>/Library/Applicaton Support/Adobe/Adobe PDF/Settings like this
and here's the list from running the script from AI
I will have to agree with MuppetMark that it is something with your install that is off.
Copy link to clipboard
Copied
Yeah, I suspect it's a problem with my install, perhaps due to CS4 and CS5 (and, until recently, CS3) being installed on the same Mac at the same time. Will try to reinstall at some point to see if the problem persists. Appreciate the input.
Regards,
-Ben
Copy link to clipboard
Copied
Delete
Copy link to clipboard
Copied
(Double post deleted)
Copy link to clipboard
Copied
Will do. Thanks again, Larry.
-Ben
Copy link to clipboard
Copied
Did anyone ever find a solution to this problem? We're currently updating a bunch of extend scripts for a client who's moving from Illustrator CS4 to CC 2014, and we've just run into this identical problem in CC 2014, both on our systems, and our client's. We never saw this in CS4, BTW.
Thanks for any insight...
--Peter
Copy link to clipboard
Copied
app.PDFPresetsList;
works fine here. CS5 on Win7
Copy link to clipboard
Copied
Thanks for that information, Carlos. I should have mentioned that this script will be running on Mac OS X, 10.9 and eventually 10.10.
Just to be clear, it works fine here as well, IF the PDF Presets window (Edit > Adobe PDF Presets...) has been opened and closed at least once after the application was launched, just as originally reported by Ben. It actually doesn't matter if one presses "Cancel" or "OK" to dismiss the window; just that it be opened and closed...
Also as reported, in the ESTK, the property simply does not appear in the Data Browser. In Script Debugger's data explorer (AppleScript), the error "an Illustrator error occurred: 1128353350 ('FNAC')" is shown.
Copy link to clipboard
Copied
I see it in mine
Copy link to clipboard
Copied
CarlosCanto wrote:
I see it in mine
Thanks, Carlos. I gather you are running on Windows? It seems that this may be a Mac-only problem. I've filed a bug report with Adobe...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now