• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to Script a File Export

Community Beginner ,
Apr 28, 2021 Apr 28, 2021

Copy link to clipboard

Copied

I am the author of a plug-in that adds a new file format (.xaml) to the File>Export>Export As... menu. In addition to using the plug-in manually, I am able to record an Illustrator Action and execute that Action successfully.

 

However, I have a user who is trying to export using a script, and they're not sure how to indicate the file format that my plug-in adds in their call:

sourceDoc.exportFile(targetFile, ExportType.JPEG);

There are many ExportTypes that have been defined by Illustrator, and as you'd guess, none of them relate to the new file format.

 

Is there a way to query for the ExportType value based on (perhaps) the friendly name of the format, then pass that along in the exportFile call? Or perhaps there's a way to indicate the value when my plug-in registers its custom file format with Illustrator? I've looked for both of these things, but I've come up short.

 

Thank you in advance for any pointers!

TOPICS
Scripting , SDK

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , May 06, 2021 May 06, 2021

Hi Michael

 

Since Export is tightly bound to already supported file formats you won't be able to use it for export.

however, you can use the below method to do the job.

 

sendScriptMessage (pluginName, messageSelector, inputString)

Sends the script message to the required plugin.

Parameters:

pluginName Plugin to which message needs to be sent.
Data type:string
messageSelector Functionality that is to be executed.
Data type:string
inputString Pass any data encoded in a string.
Data type:string
Returns:string


H

...

Votes

Translate

Translate
Adobe
Adobe Employee ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hi Michael

 

Since Export is tightly bound to already supported file formats you won't be able to use it for export.

however, you can use the below method to do the job.

 

sendScriptMessage (pluginName, messageSelector, inputString)

Sends the script message to the required plugin.

Parameters:

pluginName Plugin to which message needs to be sent.
Data type:string
messageSelector Functionality that is to be executed.
Data type:string
inputString Pass any data encoded in a string.
Data type:string
Returns:string


Hope it helps!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Thank you, @RonakMehta! This is a great pointer, and I'll give it a try.

 

I'll report back with my results so that others can use this as a resource in the future.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

Thanks again, @RonakMehta!

 

Indeed, sendScriptMessage works great for this scenario. I had to add scripting support to my plug-ins (to accept and process the scripted messages), and once that was done, everything works great.

 

While it's specific to my plug-ins, you can read more in my blog post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 12, 2021 May 12, 2021

Copy link to clipboard

Copied

LATEST

I remember the canvas converter from Mordy's blog, what a magical blog it was - makes me think time just goes too fast, there's still such gems inside there. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines