Skip to main content
Inspiring
March 17, 2022
Answered

BridgeTalk , passing Illustrator variable to Photoshop

  • March 17, 2022
  • 2 replies
  • 721 views

I need some help here...

From an Illustrator script, I want to pass  app.activeDocument.path, and use it at another Photoshop  script

It is possible ?

 

This topic has been closed for replies.
Correct answer Charu Rajput

Try following

function main() {
    var myDoc = app.activeDocument;
    var _path = myDoc.path
    var bt = new BridgeTalk();
    bt.target = "Photoshop";
    var myScript = phScript.toString() + "\r";
    myScript += "phScript(\"" + _path + "\")";
    bt.body = myScript;
    bt.send();
}

main()

function phScript(path) {
    alert("Active document path of Illustartor document : " + path)
}  

2 replies

Charu Rajput
Community Expert
Community Expert
March 17, 2022
siomospAuthor
Inspiring
March 17, 2022

I have already tried without success!

Charu Rajput
Community Expert
Charu RajputCommunity ExpertCorrect answer
Community Expert
March 17, 2022

Try following

function main() {
    var myDoc = app.activeDocument;
    var _path = myDoc.path
    var bt = new BridgeTalk();
    bt.target = "Photoshop";
    var myScript = phScript.toString() + "\r";
    myScript += "phScript(\"" + _path + "\")";
    bt.body = myScript;
    bt.send();
}

main()

function phScript(path) {
    alert("Active document path of Illustartor document : " + path)
}  
Best regards
pixxxelschubser
Community Expert
Community Expert
March 17, 2022

Normally I would say: yes. But please, explain a bit more in detail.

siomospAuthor
Inspiring
March 17, 2022

Hi, I will try to explain

At photoshop, via scripts I prepare mockups from the active document, and export them at original photoshop document folder

// Make mockups script, set doc path at original photoshop document, as enviroment variable for later use

$.setenv("myFolder_doc_env" ,app.activeDocument.path);

// Export script, use the enviroment variable

var myFolder_doc = $.getenv("myFolder_doc_env")

Some documents are vectors, with this  script I import illustrator document to photoshop

#target Illustrator
var newPathAndname =app.activeDocument.path+"/"+app.activeDocument.name;
var psfile = new File(newPathAndname);
if (psfile.exists) { photoshop.open(psfile); }
else { alert('file does not exist');}

For exporting the mockup from photoshop,   i need  "myFolder_doc" variable, to be the original illustrator document  path
I hope it is clear now!