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

Export Path to Illustrator

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

Thanks for helping me out with this! I've attached a screenshot showing the action I recorded with the script included as you suggested above. The files are still saving as .jpg in the designated folder however. I'll also include a copy of the .jsx file that's loaded into Ps/Application/Presets/Scripts folder. Maybe there is an error with the way the file is saved?

 

 

 


There are no paths in that screenshot?

 

Does the script work by itself, without being used in the action or batch?

 

You should be able to untick or delete the action step to export paths, as this is being performed by the script.

 

I can't see the full path to the script file name as the panel is not wide enough. Please post a cropped screenshot of the action panel with the panel wide enough to view the full path and name of the script.

 

The script needs to be saved with a .jsx filename extension, not .txt (which I can't see in the screenshot).

 

The issue may be with your File > Automate > Batch settings, please provide a screenshot of how that is setup.