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

BridgeTalk , passing Illustrator variable to Photoshop

Engaged ,
Mar 17, 2022 Mar 17, 2022

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 ?

 

TOPICS
Scripting
489
Translate
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 , Mar 17, 2022 Mar 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)
}  
Translate
Adobe
Community Expert ,
Mar 17, 2022 Mar 17, 2022

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

Translate
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
Engaged ,
Mar 17, 2022 Mar 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!

 

Translate
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 ,
Mar 17, 2022 Mar 17, 2022
Translate
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
Engaged ,
Mar 17, 2022 Mar 17, 2022

I have already tried without success!

Translate
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 ,
Mar 17, 2022 Mar 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
Translate
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
Engaged ,
Mar 17, 2022 Mar 17, 2022
LATEST

It works!

Thank you  @Charu Rajput

Translate
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