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

(Applescript) do javascript command no longer works in 25.1

Community Beginner ,
Jan 08, 2021 Jan 08, 2021

Copy link to clipboard

Copied

Hi we got plenty of script in our workflow, and since the 25.1 update the scripts no longer work. (Was working in 25.0.1)

 

They all have 1 thing in common, 

 

tell application "Adobe Illustrator"

do javascript "JAVASCRIPT CODE HERE"

end tell

 

Nothing works and i'm resulted with:

missing value

 

Whatever is inside the quotes, nothing works, we always get the missing value as as result

 

I tried to copy my Javascript code in a .jsx file and open it from the applescript and it worked but we cant link a .jsx file there as variable data is injected in the script.

 

Is there something different in the way 25.1 handles javascript inside an applescript versus all the Illustrator previous versions?

 

 

Thank you for your help!

TOPICS
Bug , Scripting

Views

4.8K

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

Community Beginner , Jan 22, 2021 Jan 22, 2021

It has been fixed in 25.2 Beta

Votes

Translate

Translate
Adobe
Contributor ,
Jan 08, 2021 Jan 08, 2021

Copy link to clipboard

Copied

I might be wrong, just a guess, but could it be Apple's security sandboxes? Make sure the System Preferences are set up to allow the AppleScript to control Illustrator etc... - I've not studied this in detail, but more recent versions of Mac OS X are very picky in what they allow. I'd have a look in 'System Preferences - Security' and make sure allowance is made for the script to control Illustrator. I think it might be under 'Automation'.

Votes

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
Community Beginner ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

Thank you for your Answer, 

It might have been a good idea, i've wiped the automation preferences to start from scratch.

I Executed the scripts, it asks me to give permission, I do and the script just don't execute.

 

Same manipulation on 25.0 and it works, there really seems to be a problem with 25.1 executing a Javascript from an applescript

Votes

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 ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

I'm unable to use the commands 'export' and 'embed' since the update for what it's worth

Votes

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 ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

haven't tried 'embed' but just also realised 'export' isn't working anymore – were you able to fix it? I went back to 24.3 because of that...

Votes

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
Community Beginner ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

No nothing have worked so far,

 

I reverted back to 25.0.1

Votes

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 ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

I'm back on 25.0.1 too - hoping it's fixed in the next update

Votes

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
Valorous Hero ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

Votes

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
Engaged ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Restart your computer, reset Automation security settings, and run your scripts afresh is good basic troubleshooting advice, but it doesn’t sound like that’s the cause.

 

I’ve not touched AI’s AppleScript interface in over a year (recent projects have all been in JSX), so haven’t been following exactly what’s changed and when, but this may be related (“foo” is me):

 

stackoverflow.com/a/58856316/7926970

 

Basically, the Illustrator application dates back to Mac OS 7 days, and some parts of its guts use pre-OSX, pre-sandboxing, macOS-defined datatypes and APIs (e.g. Carbon Alias and File Managers) that Apple has long since deprecated and will eventually phase out. Therefore Adobe needs to replace old AI code that uses those old, dying APIs with new code that uses modern, supported macOS APIs. Unfortunately, AppleScript, being another System 7-era technology and long neglected by Apple, is still using some of those old dying datatypes itself, and while it supports some (though not all) of the newer types this support is kludgy, inconsistent, worryingly brittle, appallingly documented. Plus, half of these datatypes don’t play well with the other half.

 

Now add some current AI engineers, who probably have little-to-no familiarity with AppleScript or Illustrator’s support for it, typing to upgrade neglected quarter-century old code so that it works well with modern macOS sandboxing, and a small but ardent base of heavy AppleScript users who rely on this whole house of cards to keep on working while all this chop and change is going on.

 

I did observe at the time that while the old AppleScript “file specifier” type still in use in some parts of AI (e.g. “file path” properties) was horrendously obsolete and long overdue for replacement, but using plain old strings to describe file system paths was a really bad idea, precisely because there’s no 100% reliable way to distinguish a string specifically describing a file path from a string that contains any old text. (This is the whole reason for having different datatypes in the first place.) Plus, the way that AppleScript performs string↔︎file type coercions (badly, inconsistently, and non-reversibly) means that older AppleScripts that used “file-like” objects would break where path strings are now expected, and vice-versa.

 

The appropriate change I said at the time would be for these properties to use “POSIX file” («class furl»), since that makes it clear what type of data it is, even in a command such as “do javascript” that accepts either a value that points to a JavaScript file or a string containing JavaScript code. So it may be that later 24.x releases and 25.0 changed again from using path strings to another “file-like” type, but with all these rolling changes—and with AppleScript’s own support and documentation being horribly confusing—it wouldn’t surprise me if it all gets tangled up in itself, particularly if AI is also trying to be “helpful” by still allowing scripts to pass file paths as plain strings. Which, as I say, is liable to turn into an error-prone mess for any command that accepts code files and code strings interchangeably.

 

To be clear, even if the above is the cause of the problem (which it may or may not be), this is Apple’s fault for running AppleScript into the ground over the last 15 years, not Adobe’s for trying (and failing) to make the resulting confusion work. Honestly, I’ve built the most advanced Illustrator automation on the planet, and I did using AI’s AppleScript interface (though not AppleScript itself) because when it works it is incredibly powerful, elegant, and a pleasure to work with (much nicer than JSX!). And even I’m counting the days till Adobe ships UXP for Illustrator now, as AppleScript infrastructure looks increasingly like a bitrotten liability, not a platform on which to build a future.

 

--

 

TL;DR: Working with files in AppleScript is a nightmare, period, and not getting any better.

Votes

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
Community Beginner ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

You seems like a script expert to me!

Is there any way to make illustrator execute javascript code from a third party app without the use of applescript?

 

Our scripts are launched from our internal system, and the only use of AppleScript is 

tell application "Adobe Illustrator"

do javascript "JAVASCRIPT CODE HERE"

end tell

 

I'd be happy to part ways from applescript but I did not find any solutions.

 

 

Thanks,

Votes

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
Engaged ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Alas, Adobe’s Creative Cloud app insists my installed copy of AI 25.0 is the latest version available to me, so I’m unable to upgrade to test it myself.

 

1. The most obvious solution, assuming this is in-house only, is to revert to an earlier version of AI that you know works (the CC app allows you to install multiple/older versions), file a bug ticket with Adobe describing previous and current behaviors, with test scripts/screenshots/error messages/etc to help them understand the issue, and hope they fix it before your next upgrade.

 

2. Still working with the problem “do javascript” command: if it won’t take a string containing JavaScript code, try writing that code to a [temporary?] file and try to pass references to that in as many different forms as you can think of to see if one of them works: POSIX path string, AppleScript “alias”, “POSIX file”, HFS path string (ugh), “file”. “Poke it all over with a stick until it does what you want” is, depressingly, one of the more effective troubleshooting techniques for AppleScript.

 

3. If you’re looking for an alternative anyway, the AppleScript interface is not the only way in. Depends on what you’re trying to achieve and how far you’re willing to go to achieve it. There’s the C++ SDK, of course, but I doubt you want to deal with that. Perhaps the CEP/Adobe Bridge users here can provide some suggestions? (I haven’t looked at how Bridge itself communicates with other Adobe apps.)

 

I do remember one enterprising AI engineer stuffing a Node-based webserver into a CEP panel:

 

medium.com/adobetech/how-to-build-a-node-js-server-in-a-panel-ba1d63ea67e2

 

(Needless to say there are security issues to consider when running any sort of webservice on a desktop; limiting client connections to localhost being an obvious start.)

 

And once UXP does ship for AI, who knows what options will be available then? Though it’ll be another year (or two, or three?) before we get that.

Votes

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
Valorous Hero ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

I really don't understand the concept of using an AppleScript API without using AppleScript?

 

Ok - but what a shame, AppleScript is not well-documented but it's somewhat like AutoHotKey - at least there's users from 2005 who have answered most pertinent questions and people who seek can find - eventually. And now you say, in addition to the technical knowledge challenges, it's internal support is lacking? That's too bad as Apple keeps making faster and faster machines so users can hurry up and manually do tasks super-fast but manually and taking days and days. But each individual thing is super fast and shiny! But it will take months.. But it's shiny, new apps!

 

And this brings me to the topic of JXA - the most poorly documented Apple version of JavaScript that has the potential to do a lot but there's not even good instructions! One time I figured something out by purely guessing!

 

I am wondering if Apple will do something about its own automation, from the looks of it I would recommend Windows setups to people and be very conservative about analyzing and taking on AppleScript work if any comes up...

Votes

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
Engaged ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

Python3 + appscript (appscript.sourceforge.net), which I wrote after getting sick of dealing with AppleScript. Basically what JXA should’ve been (in addition to Apple’s answer to Node), had Apple’s Mac Automation team been run by a competent manager, but it failed so hard Apple scrapped that entire department in 2016. Whatever the future of Apple automation may be, it lies with the Siri/Shortcuts team now.

Votes

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
Valorous Hero ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Can you elaborate on how you used AI's AppleScript interface but not AppleScript itself?

Votes

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 ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

I to am having issues using my Applescripts. I have been using my particular ApleScript for over 6 years with no issues. The issue began with the 25.1 update this morning whith script to starting to fail. It worked correctly with 25. Also I am still using Mojave, so it it is not related to a new Operating System. If I try to use the script with in an Illustrator Action I will get a message "Adobe Illustrator got an error: missing value doesn't understand the "concentrate rotation matrix" message. If I run the script out of the Applescript dropdown, the message doesnt come out but it has the same result. It does all of it's funtion except there is a rotate at the end and it doesnt do that part. I have three friends that use this script and they too are now now getting this Issue. 

Votes

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
Community Beginner ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

Yeah i'm also on Mojave nothing else changed except update to 25.1,

I've reverted back to 25.0.1 and it's working, there is definitely something wrong in this version

Votes

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 ,
Jan 19, 2021 Jan 19, 2021

Copy link to clipboard

Copied

Getting a similar issue with Illustrator 2021, but with the export command. "Adobe Illustrator got an error: current document doesn’t understand the “export” message."

 

seems like a very basic command to be broken

Votes

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
Community Expert ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

I have the same symptoms with Mojave and Illustrator 25.1.

 

I've created a topic on uservoice, please vote for it.
(Applescript) do javascript command no longer works in Illustrator 2021(25.1) 

Votes

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
Community Beginner ,
Jan 22, 2021 Jan 22, 2021

Copy link to clipboard

Copied

It has been fixed in 25.2 Beta

Votes

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
Explorer ,
Feb 11, 2021 Feb 11, 2021

Copy link to clipboard

Copied

Hello!

 

Are you certain that is the case? I am running Illustrator version 25.2.0 and it just won't execute the Javascript I send it via AppleScript. Here is my code:

set myJavascript to "
#target illustrator
function test(){
    #include '/Users/opus/Desktop/ApplySaturation.jsx'
};
test();
"
on adding folder items to theAttachedFolder after receiving theNewItems

	-- Get the name of the attached folder
	tell application "Finder"

		set theName to name of theAttachedFolder
		-- Count the new items
		set theCount to length of theNewItems

		-- Display an alert indicating that the new items were received
		activate

		display alert "Attention!" message (theCount & " new items were detected in folder " & (quoted form of theName) & "." as string)
		tell application "Adobe Illustrator"
			do javascript myJavascript
		end tell
		display alert "check"
	end tell
end adding folder items to

It's a fairly easy example, and if I run just that bit of javascript directly from illustrator it works perfectly. When this AppleScript is executed the "check" alert never executes. Not sure if I am missing something here but I've gone over privileges and everything I can think of so it feels like it must be some sort of bug.

 

If you have any ideas as for why this isn't working for me that would be great.

 

Thanks 🙂

Votes

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
Community Beginner ,
Feb 11, 2021 Feb 11, 2021

Copy link to clipboard

Copied

I'm no Applescripct expert so I can't really help you on this,

 

Is your script working on 25.0?  I would start there

Votes

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

Copy link to clipboard

Copied

LATEST

After Illustrator's last update 25.2, all of my scripts are behaving like well manored children again. Thanks Adobe Team. 

Votes

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