Problem connecting to Adobe Illustrator dictionary / object model with external AppleScript editor

New Here ,
Feb 20, 2021 Feb 20, 2021

Copy link to clipboard

Copied

Hi there - 

I've been developing AppleScript code to automate certain processes in Adobe Illustrator using an external AppleScript editor called Script Debugger.  Lately I've been unable to connect to the AI dictionary / object model, which has made my development process a lot more difficult.  Not being sure if this was an Adobe issue or a Script Debugger issue, I posted a question about this to the Script Debugger forums.   The reponse I received informed me that there is an issue with Illustrator's Info.plist file, specifically that it is missing its NSAppleScriptEnabled entry. 

 

I'm not sure if this is the appropriate venue for me to report this issue to Adobe but I'm hoping someone might be able to help point me in the direction of getting this resolved. The respondent on the Script Debugger forum did provide me with a work-around, but it would be more helpful to me to have the root issue resolved.

 

Kind regards,
DT

TOPICS
Bug, Scripting

Views

60

Likes

translate

Translate

Translate

Report

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

New Here , Feb 21, 2021 Feb 21, 2021
Hi there -Thanks for all this detailed info. Yeah I'm not the hugest fan of AppleScript myself but I do like the debugging features in Script Debugger, as they facilitate my general 'learn as you go' process.  I tried my hand at learning Javascript but wasn't able to find a similar development environment, and ultimately found the task of learning it too complex for my needs and purposes.  That being said, if you have any recommendations for me for Javascript development platforms geared towards...

Likes

translate

Translate

Translate
Participant ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

The reponse I received informed me that there is an issue with Illustrator's Info.plist file, specifically that it is missing its NSAppleScriptEnabled entry.

 

Pretty sure† Shane’s incorrect. The (confusingly named) NSAppleScriptEnabled flag enables macOS’s Cocoa Scripting framework to handle incoming Apple events (“AppleScript commands”). However, Illustrator already implements its own Apple event handling via the older Carbon/CoreServices Apple Event Manager APIs. Turning on Cocoa Scripting would very likely interfere with that, causing behavioral and/or terminology bugs.

 

If the application stores its “AppleScript terminology” in SDEF format then what should appear in application’s Info.plist is an OSAScriptingDefinition entry identifying the app’s .sdef file. If that entry is missing, macOS won’t be able to read the app’s SDEF and the app will appear “unscriptable” as far as Script Editor/Script Debugger are concerned.

 

However, that only applies to apps that have an .sdef file. Apps that date from MacOS9 days may still use the original AETE terminology format, which is stored in a .rsrc file. That’s what previous versions of AI use, up to and including 25.0. If Adobe have migrated from AETE to SDEF in AI 25.2 then I’m already grimacing as it’ll almost certain that Stuff Will Break as a result. (Perhaps explaining the woes in 25.1?)

 

--

† Actually 99.9% certain that Shane is completely—and dangerously—wrong. However, it’s been a few years since I’ve had to deep-dive the neglected shambles‡ that is Apple’s AppleScript/Apple event/OSA system. Badly documented APIs and unexpectedly entangled behaviors are par for the course, and it’s always possible some inexperienced engineer somewhere has subsequently done something to make the NSAppleScriptEnabled flag mandatory for all Apple event-aware apps, in which case unexpected fireworks will likely follow.

 

‡ Apple disbanded its Mac Automation team in 2016 and fired the manager responsible after years of failures, so until/unless there are strong public indications that they’re investing in and rebuilding that platform following a decade of decay I think it sensible to approach it as abandonware and plan projects accordingly. I’ve already switched to JSX for new AI work: although Adobe’s JavaScript automation is also ancient and awful in lots of ways, at least Adobe is actively working to modernize it and eventually migrate everyone to UXP.

Likes

translate

Translate

Translate

Report

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 ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

One other thought: I think Script Editor keeps a cache of previously-read terminology, and I wouldn’t be surprised if SD does as well. I think those caches may get flushed on restarting macOS, though don’t quote me on that. If not, quit SE and look in ~/Library/Caches, you’ll probably find a “com.apple.ScriptEditor2” which you can toss. (Of course, it’s possible there are caches elsewhere, possibly kept by macOS rather than individual apps. I’m not going to spelunk it right now.) If that still doesn’t work, I’d be having another look at AI to see if the problem lies there, but honestly this stuff is such a pain to troubleshoot. You might just want to revert to AI 25.0 for now and hope someone else figures it out before you next have to upgrade.

Likes

translate

Translate

Translate

Report

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
New Here ,
Feb 21, 2021 Feb 21, 2021

Copy link to clipboard

Copied

Hi there -

Thanks for all this detailed info. Yeah I'm not the hugest fan of AppleScript myself but I do like the debugging features in Script Debugger, as they facilitate my general 'learn as you go' process.  I tried my hand at learning Javascript but wasn't able to find a similar development environment, and ultimately found the task of learning it too complex for my needs and purposes.  That being said, if you have any recommendations for me for Javascript development platforms geared towards Adobe products and for relative newbies, I'm all ears.  I'm not completely coding illiterate, but my knowledge is pretty obsolete (think Visual Basic for Microsoft Access). 

 

Regardless, I took your advice and reverted to a previous version of Illustrator and all seems to be working as before.  So I guess I'm sticking to AppleScript for now. 

 

Regards,

DT

Likes

translate

Translate

Translate

Report

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