Scripting component error?

Can anyone tell me why I get the following error after running the subroutine below?

Error:
“Adobe Illustrator got an error: Scripting component error.”

Code:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Hi

Not sure if this will help and its not exactly what your asking.
But this line in your Illustrator script should delete unused swatches and other stuff “symbols” etc…

do script "Delete Unused Palette Items" from "Default Actions" without dialogs

its a default action in illustrator

Sorry I should have explained that.

The Action simply selects all unused swatches and then deletes them.

I had to resort to using an action because there is no applescript command to do this. Also the palette menu is not accessable through system events because Adobe has not labelled each of the palettes.

Also you can not assign the “Select Unused Swatches” command a custom keyboard shortcut as it does not appear in any of the menu bar menus.

I could write a lengthy and some what slow script to go through each item in the Illustrator document recording what colours are used and then delete the remaining swatches that weren’t. But it is much faster to use the built in command.

I believe the error is occurring due to the “do script” command but am not sure.

hi

Sorry. maybe i don’t fully understand still what your trying to acheive
but the line

do script "Delete Unused Palette Items" from "Default Actions" without dialogs

will delete all unused swatches.
sorry if i misunderstand.
you could assign a keyboard shortcut to this action if you want but i can’t see why you would need

Thank you Pidge1

I changed my do script command to point to the Default Action - “Delete Unused Palette Items” which works flawlessly now.

I had the added bonus of discovering that the little icon to the left of each action allows you to toggle the dialog display on or off. This meant I could reduce my script to the following:


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]