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

Address Illustrator from Photoshop Script

Explorer ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Hey guys, maybe you could help me with a relatively simple problem. I am writing a script for automatic image creation in Photoshop. One of the steps includes opening an Illustrator File and creating assets. Unfortunatly if i run the function in the Photoshop Script he opens te .ai file in Photoshop instead of Illustrator. How can i change app.open() to open in Illustrator instead of Photoshop.

 

This is my Photoshop Script that should redirect to Illustrrator in one certain step:

#target photoshop
#include "CreatePlaceholders.jsx"

var sourceFolder = Folder.selectDialog("Select a folder to process");
createPlaceholders(sourceFolder);

 

This is my jsx Script that should run in Illustrator:

#target illustrator
function createPlaceholders(path){
var masterfile = File(path + "/Farbe-Master.ai");
    alert(app.name);
    app.open(masterfile);
};

 

Best reagards Maxim

TOPICS
Actions and scripting , Windows

Views

752

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

Community Expert , Aug 17, 2020 Aug 17, 2020

Hi,

I have tried your script and it gives the desired result. AI file is opened in the Illustrator only. But here is another solution as well. You can use BridgeTalk to communicate between two applications. You can write complete script in a single file as below

#target photoshop
//#include "CreatePlaceholders.jsx"

var sourceFolder = Folder.selectDialog("Select a folder to process");
createPlaceholders(sourceFolder);

function createPlaceholders(path) {
    var masterfile = File(path + "/Farbe-
...

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

You need to use Place not open the get an AI file into you Photoshop as a smart object layer then you can open the object and the AI object will open in AI.

 

I do not believe #Target illustrator will start AI if the running script is being run by Photoshop ScriptingSupport plug-in. It may if you had your OS run the script or #target may be a Adobe extendscript toolkit statement.  I only include #target Photoshop in my script for others if they use extendscript toolkit. I do not I hade problems with it and I believe after #target Photoshop a Photoshop version number of some kind is required. I do not know javaScript I just hack....

JJMack

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 Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

So in Photoshop 

 Place(file)

Open(current Layer)

will open the Object in Ai if File is an AI file and at the point your script will wait the see if the work file Photoshop created for the  smart  object is updated or just closed.  If Updated photoshop will updated the object. 

 

If the File is a file type Photoshop Processes.  The Object work file will open in Photoshop  the script will continue to run so it can edit the object file,  If the script commits changes to the object work file  Photoshop will updater the placed object.  I do that in my Mockup scripts. However, my scripts do not open none Photoshop objects and they do not place the object files into the Mocckup templates in the first place. The smart object layer are created by the users when the create the mockup templates. 

JJMack

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 Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Hi,

I have tried your script and it gives the desired result. AI file is opened in the Illustrator only. But here is another solution as well. You can use BridgeTalk to communicate between two applications. You can write complete script in a single file as below

#target photoshop
//#include "CreatePlaceholders.jsx"

var sourceFolder = Folder.selectDialog("Select a folder to process");
createPlaceholders(sourceFolder);

function createPlaceholders(path) {
    var masterfile = File(path + "/Farbe-Master.ai");
    var bt = new BridgeTalk();
    bt.target = "illustrator";
    bt.body = "app.open(new File('" + masterfile + "'));";
    bt.onResult = function (inBT) { 
        result = eval(inBT.body); 
    };
    bt.onError = function (inBT) { 
        alert(inBT.body); 
    };
    bt.send(8);
};

 

OR

If you want to separate files you can work like

 

Photoshop Script

#target photoshop
#include "CreatePlaceholders.jsx"

var sourceFolder = Folder.selectDialog("Select a folder to process");
createPlaceholders(sourceFolder);

 

Illustrator Script - No, need to add target engine here

function createPlaceholders(path) {
    var masterfile = File(path + "/Farbe-Master.ai");
    var bt = new BridgeTalk();
    bt.target = "illustrator";
    bt.body = "app.open(new File('" + masterfile + "'));";
    bt.onResult = function (inBT) { 
        result = eval(inBT.body); 
    };
    bt.onError = function (inBT) { 
        alert(inBT.body); 
    };
    bt.send(8);
};

 

Let us know if this works for you.

Best regards

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 Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

That is nice to know as I wrote I do not know  JavaScript ot Photoshop scripting and have never used Adobe BridgeTalk I knew it existed I rarely use the Bridge and I do not  install the Application my Adobe subscription allows Photoshop sufficient amount of issues for me I do not need more. I restrict my use to Photoshop. However I will admit I played with Adobe Dimension.

JJMack

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 Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Yes, I know JJMack you do not know Javascript or Photoshop scripting but you know many more things that even helps me and other users on this forum. 🙂

Thank you. 🙂

 

Best regards

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
Explorer ,
Aug 20, 2020 Aug 20, 2020

Copy link to clipboard

Copied

LATEST

That worked, had to do some workarounds because both scripts ran simultaniously, but the results look good.

 

thank you very much for the help

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