Highlighted

Address Illustrator from Photoshop Script

Community Beginner ,
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

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

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.

TOPICS
Actions and scripting, How to, Windows

Views

111

Likes

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

Address Illustrator from Photoshop Script

Community Beginner ,
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

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

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.

TOPICS
Actions and scripting, How to, Windows

Views

112

Likes

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
Aug 17, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
Aug 17, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
Aug 17, 2020 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 17, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
Aug 17, 2020 1
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Aug 17, 2020 0
Community Beginner ,
Aug 20, 2020

Copy link to clipboard

Copied

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

 

thank you very much for the help

Likes

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
Reply
Loading...
Aug 20, 2020 1