Skip to main content
jf8526
Participating Frequently
February 14, 2022
Answered

Export Path to Illustrator

  • February 14, 2022
  • 3 replies
  • 4153 views

Hi,

I'm running Ps 23.1.1 on a MacBook Pro M1 with Os 11.4 installed.

In Photoshop I'm trying to create an action that lets me open a .jpg file. Select color (RGB 0,0,0) --> Make a work Path --> export Paths to Illustrator. 

The action runs, but I end up with a bunch of .jpg files after the action is finished running.

It seems I'm only able to save this action as either .jpg/.PSD or .TIFF files.

How do I save "export Path to Illustrator" as .ai file when I run this action?

I'm really a beginner when it comes to Ps and Ai...hopefully it's not to hard.

Thx!

 

This topic has been closed for replies.
Correct answer Stephen Marsh

This version will prompt for a save location if the source doc is unsaved. All paths are saved into a single file (not as separate paths):

 

// Export All Paths to Illustrator Using Variable Document Name.jsx
// Handles both saved and unsaved docs

#target photoshop

/*
Export all paths to Illustrator format using the current document name
This script is suitable for use in the File > Automate > Batch command
https://community.adobe.com/t5/photoshop/how-to-export-paths-to-ai-in-action-batch/m-p/11049923 
Based on the following topic thread:
https://community.adobe.com/t5/photoshop/exporting-all-paths-to-illustrator-error/m-p/8796143
*/

var doc = app.activeDocument;
try {
    // Use the previously saved path
    var docPath = doc.path;
} catch (e) {
    // If unsaved, select the desktop
    // var docPath = "~/Desktop/";
    var docPath = Folder.selectDialog("Unsaved base file, select the output folder:");
}
var docName = doc.name.replace(/\.[^\.]+$/, '');
var newFile = File(docPath + '/' + docName + '_Paths' + '.ai');
var expOptions = new ExportOptionsIllustrator();
expOptions.path = IllustratorPathType.ALLPATHS;
doc.exportDocument(newFile, ExportType.ILLUSTRATORPATHS, expOptions);
// alert('All Photoshop paths have been exported as a single Illustrator file in:' + '\r' + docPath);

 

 

3 replies

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
February 15, 2022

This version will prompt for a save location if the source doc is unsaved. All paths are saved into a single file (not as separate paths):

 

// Export All Paths to Illustrator Using Variable Document Name.jsx
// Handles both saved and unsaved docs

#target photoshop

/*
Export all paths to Illustrator format using the current document name
This script is suitable for use in the File > Automate > Batch command
https://community.adobe.com/t5/photoshop/how-to-export-paths-to-ai-in-action-batch/m-p/11049923 
Based on the following topic thread:
https://community.adobe.com/t5/photoshop/exporting-all-paths-to-illustrator-error/m-p/8796143
*/

var doc = app.activeDocument;
try {
    // Use the previously saved path
    var docPath = doc.path;
} catch (e) {
    // If unsaved, select the desktop
    // var docPath = "~/Desktop/";
    var docPath = Folder.selectDialog("Unsaved base file, select the output folder:");
}
var docName = doc.name.replace(/\.[^\.]+$/, '');
var newFile = File(docPath + '/' + docName + '_Paths' + '.ai');
var expOptions = new ExportOptionsIllustrator();
expOptions.path = IllustratorPathType.ALLPATHS;
doc.exportDocument(newFile, ExportType.ILLUSTRATORPATHS, expOptions);
// alert('All Photoshop paths have been exported as a single Illustrator file in:' + '\r' + docPath);

 

 

Stephen Marsh
Community Expert
Community Expert
February 14, 2022

A script that I made for previous forum discussion, all paths are saved into a single file (not as separate paths):

 

// Export All Paths to Illustrator Using Variable Document Name.jsx
// Only works with previously saved docs

#target photoshop

/*
Export all paths to Illustrator format using the current document name
This script is suitable for use in the File > Automate > Batch command
https://community.adobe.com/t5/photoshop/how-to-export-paths-to-ai-in-action-batch/m-p/11049923 
Based on the following topic thread:
https://community.adobe.com/t5/photoshop/exporting-all-paths-to-illustrator-error/m-p/8796143
*/

try {
    activeDocument.path;
    var doc = app.activeDocument;
    var docPath = doc.path;
    var docName = doc.name.replace(/\.[^\.]+$/, '');
    var newFile = File(docPath + '/' + docName + '_Paths' + '.ai');
    var expOptions = new ExportOptionsIllustrator();
    expOptions.path = IllustratorPathType.ALLPATHS;
    doc.exportDocument(newFile, ExportType.ILLUSTRATORPATHS, expOptions);
    // alert('All Photoshop paths have been exported as a single Illustrator file in:' + '\r' + docPath);
} catch (err) {
    alert('An image must be both open and/or saved before running this script!')
}

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

jf8526
jf8526Author
Participating Frequently
February 14, 2022

Where should I insert this script? Would you be able to walk me through, step by step?

Thx!

Stephen Marsh
Community Expert
Community Expert
February 14, 2022

The instructions are at the link under the script (Downloading and Installing Adobe Scripts).

 

Quickstart:

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not word-processor)
  3. Paste the code in
  4. Save the text file as .txt
  5. Rename the file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run

 

Stephen Marsh
Community Expert
Community Expert
February 14, 2022

One way: Actions panel menu, insert menu item and then select File > Export > Paths to Illustrator...

jf8526
jf8526Author
Participating Frequently
February 14, 2022

Thank you, I'm not sure I completely follow your way of doing this. Maybe I should mention that I would like to run this action as a batch...

 

Stephen Marsh
Community Expert
Community Expert
February 16, 2022

Thanks for sending a screenshot of the batch window. I can only select "Default" as the set and then I chose your sript in the action drop down window. With this set up the script is running and I'm able to run the batch! The only problem I'm experiencing now is that it will only save the .jpg files in the folder as .ai paths when the "Open" action is toggled on. So I have to select each .jpg file on at a time in the folder manually while the batch script runs. This is the only way it currently saves the .ai file in the folder. If I untoggle the first "Open" action the batch script runs through the entire folder of .jpg's but doesn't save them as .ai files. I'll include a screenshot. Not sure if I'm missing something with the way my batch is set up or if this is the way to run the script. It's already a tremendous time saver so thanks for helping me get it this far! Really appreciated. Thank you!



@jf8526 wrote:

I can only select "Default" as the set and then I chose your sript in the action drop down window.

 

I would suggest that you create a new action set (folder) rather than leaving this in the Default Actions.

 

Then drag the action out of the default set into the new set.

 

Then save the new action set to .atn file.

 

https://prepression.blogspot.com/2017/01/photoshop-custom-action-file-backup.html

 

More here:

 

https://helpx.adobe.com/photoshop/using/creating-actions.html

 

https://helpx.adobe.com/photoshop/using/actions-actions-panel.html#about_actions_and_the_actions_panel

 

https://helpx.adobe.com/photoshop/using/playing-actions.html#playing_and_managing_actions