Illustrator Plug-In Updates and New Scripting Support

I’ve updated all three of my plug-ins to support Adobe Illustrator 2021 (25.x). It’s hard to believe that Ai->XAML was released almost 16 years ago in July, 2005! Ai->Canvas was released almost 11 years ago in October, 2010. And my youngest, Duplicate, is coming up on 4 years this July. Amazing.

Over the years, I’ve received occasional requests about scripting my export plug-ins, but because I don’t do any Illustrator scripting myself, I never took the time to figure out how to automate them. Recently, though, a user contacted me about converting 1,400 SVG files to XAML, and this provided the perfect excuse to dig-in.

This user had understandably tried to use the exportFile(exportFile,exportFormat[,options]) method on Document to export to XAML. According to the documentation, exportFile:

Exports the document to the specified file using one of the predefined export file formats.

Unfortunately, the formats that my plug-ins add aren’t “predefined,” so this method won’t work.

Fortunately, Illustrator plug-ins can optionally add support for the sendScriptMessage(pluginName, messageSelector, inputString) method on Application. This simple method:

Sends a plug-in-defined command message to a plug-in with given input arguments, and returns the plug-in-defined result string.

This is exactly what was needed, and support has been added to both export plug-ins.

To automate an export with Ai->XAML, pluginName must be “XAMLExport”. The messageSelector can be “ExportWPF” or “ExportSilverlight”. The inputString is the OS-appropriate file path destination (e.g. “c:\Users\mike\output.xaml” or “/Users/mike/output.xaml”). The returned string reports whether the export succeeded or failed.

For Ai->Canvas, pluginName must be “Ai2Canvas”. The messageSelector must be “Export”. The inputString is the OS-appropriate file path destination as described above. The returned string reports whether the export succeeded or failed.

The example script in the Ai->Canvas GitHub repo should get you going.

Note that I’ve also dropped 32-bit support for the Windows plug-ins, as I don’t think you can obtain a 32-bit version of Illustrator anymore.

You can download the latest version of the Adobe Illustrator Scripting Guide via the Adobe Developer Console.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *