Scripting Illustrator bug help!

Hi

I have a re-occuring problem that I hope you can help with.

When I am scripting for Adobe Illustrator everything seems to works fine while writing the code. But a lot of the time, I find that when I want to edit the script later the script does not want to compile and a dialog says that there is a syntax error and highlights a section of code that clearly DOES NOT have an error.

I think this is a bug. If so, has anyone experienced it before and is there a way round it. It’s a bit crippling at the moment because it effects many of the scripts I am writing.

Also does anyone know if there is somewhere a can report the bug to?

Here is an example of a section of code that errors (at the word “path”.???).


tell application "Adobe Illustrator"
	activate
		tell document 1
			set selected_rectangles to every path item whose selected is true
			set hidden of every path item whose selected is true to true
		end tell
end tell

It looks to me as though when compiling, applescript is not recognising the Adobe Illustrator terms that it should be.

Thanks

TIm

Edit–

Sorry the Syntax Error reads

“Expected class name but found property”

Edit–

OK. So I have restarted the Mac and this seems to be working again. But this error happens so often to me that I can’t believe that I have cured it. It will occur again. Bit of a pain…

Illustrator scripting is a colossal disaster area. Most of the program features aren’t addressable through the scripting dictionary. Many are not addressable through actions either. There is no equivalent to “Action Manager Code” or the Scripting Listener Photoshop has. Almost nothing has absolute references, only relative references that do not update as the script runs, so your script ends up referring to the wrong items once anything get modified. There are bugs out the wazoo that people have been asking them to fix for 10+ years that have never been fixed.

So basically, things are bleak.

A few things I’ve noticed:

  1. Adobe overrides OSX’s program associations. If you have two versions of AI or PS or whatever installed, and use
    tell application “Adobe Illustrator.app”
    Then Adobe overrides OSX and decides which application that command gets sent to, and will change it spontaneously in annoying ways… a script will start executing in one version of AI, and then spontaneously launch another version partway through and try to keep executing in the other version.

I bring this up because your error sounds like Applescript has stopped recognizing AI specific scripting terms from Applescript dictionary for AI. I’ve had that too. In my experience, it might help to make all your “tell” statements use the full application path:

"tell application “/Applications/Adobe Illustrator CS6/Adobe Illustrator.app”

  1. Restart AI. If this is an automated script that batches files, make it run a counter on the repeat loop and automatically quit and restart AI every 100 files or so. I’ve batch processed 30,000+ files with Applescript with AI, and AI absolutely routinely just quits working with Applescript after a while. Restarting it fixes that. So it was just stopping with errors that made no sense every few hundred or thousand files, but the identical script could handle 10’s of thousands of files without a single error if I just scripted it to quit and relaunch AI every so often.

But basically, best of luck. It’s a buggy mess.

Thank you for your response. That’s a great help and I’ll try restarting Illustrator next time. Also I do have multiple Illustrator versions installed but at the moment there is no way round that for me, due to third party software that only works with older versions.

I agree that it is a bit of a mess but as bad as it is, having any applescript compatibly at all has saved my company thousand every month. So I/we have to put up with it and hope Adobe continue to support scripting.

Thank You (and sorry for delay in responding).

Oh yeah, AI scripting has saved us a ton of $ too. You can picture batching the 30k images in a non-automated fashion would not be cheap, and we’re running 1,000+ lines of AI code 100’s of times a day. It’s essential.

It’s just annoying that it’s never-updated and very buggy.

Just to be sure we’re on the same page, having multiple versions of AI installed (no way around it for us either ATM) only caused problems until we learned to always use AI “tell” statements in the full path form:

"tell application “/Applications/Adobe Illustrator CS6/Adobe Illustrator.app”

That solved a number of headaches for us.

  • Tom.