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

Export Path to Illustrator

  • February 14, 2022
  • 3 replies
  • 4129 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 15, 2022

Yes, knowing that you wish to batch this changes things greatly. The action method is not great for batching. The script is better suited to batching, however, the files need to be saved. I could change the script to work with both saved and unsaved files by updating the code.

 

You can record the script into an Action, then use the File > Automate > Batch command to run the action+script over multiple files.