JSX runs differently from KM than when run directly in Adobe Illustrator. Why?

When I run this simple JSX directly in Adobe Illustrator it works fine and the selection is maintained.
But when it is run through KM the selection is lost after the Illustrator Action is run. Why the difference?

Running it via a "Simulated Keystroke" works fine from KM, but I would prefer to call it by name because Illustrator Action Keystrokes can be easily changed or lost.

Do Action "Unite" (AI).kmmacros (4.3 KB)

Here is a copy of the Illustrator Action if anyone is interested in testing this.
I'm using AI CC 2015.3.

I have the same problem on my Mac (10.14.3) with my Illustrator CC 2019 (23.0.2)

Try this instead:

It should work fine.

1 Like

@carycrusiau, Thank you! That solved it. I like the directness of Applescript from KM. I just seem to find more resources for Javascript. Guess I'll be learning more Applescript. :slight_smile:

Personally, I prefer JavaScript to AppleScript. Just a matter of taste. But I use both. I usually save my JSX files in a Dropbox folder then I simply use an Execute AppleScript inside Keyboard Maestro:

1 Like

Yes, that's what I've been doing in most cases (I think I learned that from you). In this case I was wanting direct access to edit the script in KM. The Applescript does that for me.

Ultimately I would like to eliminate AI Actions completely, from our workflow. There are just some things I don't know how to handle directly in a script… yet.

I also use AI Actions because some very rare steps are not available in JavaScript or AppleScript.