Skip to main content
Inspiring
October 7, 2022
Answered

Running an action from a script crashes Illustrator in AI 2021 and AI 2022

  • October 7, 2022
  • 1 reply
  • 1033 views

Attempting to run any action from applescript or javascript is always resulting in Illustrator 2021 or 2022 immediately crashing for me.

I've tried on multiple computers, and running it on a fresh install of AI 2022 with no settings changed.

It doesn't matter which Action Set is used, I've tried the included "Default Actions."

 

The identical scripts work fine from AI CC2020 back to at least AI CS6.

For example, I can copy and paste this stright from Adobe's ADOBE ILLUSTRATOR CC SCRIPTING REFERENCE: APPLESCRIPT:

 

tell application "Adobe Illustrator"

do script "Opacity 60 (selection)" from "Default Actions" without dialogs

end tell

 

Make a new Illustrator document and run it, and AI instantly freezes and stays frozen indefinitely. It needs to be force quit.

 

Running this or any other action from any action set by selecting it in the Actions palette and clicking the "play" button works as expected.

 

Using the equivalent javascript-

app.doScript ("Opacity 60 (selection)","Default Actions")

has the same result - instant crash of AI 2021 or AI2022.

 

And running the identical scripts on the same computers on prior versions of AI leads to the action running as expected.

Correct answer TomT-shirts

Quite possibly, I don't have a Windows machine to try it on.

 

However, great news! We have found an easy fix.

 

It just requires an "activate" immediately before running the action, to be sure Illustrator is the frontmost application.

 

I don't know why it is now required for AI to be in he foregroud to execute an action now, when it wasn't required from AI CS6 through AI CC 2020. But at least it's an easy fix.

 

It would still be great if Adobe would fix it to work without requiring that AI be in the foreground, so that it doesn't break all the old scripts that aren't forcing Illustrator to be the frontmost app... also because their documentation in the their scripting guide says nothing about this, so even their own examples don't work.

 

But this does work:

tell application "Adobe Illustrator"

activate

do script "Opacity 60 (selection)" from "Default Actions" without dialogs

end tell

1 reply

CarlosCanto
Community Expert
Community Expert
October 7, 2022

would that be a Mac only issue? on Windows 11 we don't have that problem

TomT-shirtsAuthorCorrect answer
Inspiring
October 7, 2022

Quite possibly, I don't have a Windows machine to try it on.

 

However, great news! We have found an easy fix.

 

It just requires an "activate" immediately before running the action, to be sure Illustrator is the frontmost application.

 

I don't know why it is now required for AI to be in he foregroud to execute an action now, when it wasn't required from AI CS6 through AI CC 2020. But at least it's an easy fix.

 

It would still be great if Adobe would fix it to work without requiring that AI be in the foreground, so that it doesn't break all the old scripts that aren't forcing Illustrator to be the frontmost app... also because their documentation in the their scripting guide says nothing about this, so even their own examples don't work.

 

But this does work:

tell application "Adobe Illustrator"

activate

do script "Opacity 60 (selection)" from "Default Actions" without dialogs

end tell

CarlosCanto
Community Expert
Community Expert
October 7, 2022

great! thanks for posting your findings!