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

Where are these files can be found?

Community Expert ,
Mar 16, 2017 Mar 16, 2017

Copy link to clipboard

Copied

From javascript_tools_guide.pdf (page 179 BridgeTalk)

" …

and the example code provided with the Adobe ExtendScript SDK.

Example code

The sample code distributed with the Adobe ExtendScript SDK includes these code examples that specifically demonstrate the use of interapplication messaging:

Interapplication messaging

MessagingBetweenApps.jsx

MessageSendingToInDesign.jsx

Shows how to send a message to a Creative Suite application and receive a response.

SendArrayToPhotoshop.jsx

Sends message to Photoshop that creates an array in the target and passes it back to the sender.

SendObjectToPhotoshop.jsx

Sends message to Photoshop that creates a JavaScript object in the target and passes it back to the sender.

SendDOMObjectToPhotoshop.jsx

Sends message to Photoshop that creates a Photoshop object in the target and passes values from it back to the sender.

SaveAsDifferentFileType.jsx

Locates an image file, uses messaging to load it into Photoshop and save it as a different file type …"

Sorry my english is not good enough to find the (red marked) jsx files. Who can help me please?

TOPICS
Scripting

Views

970

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
community guidelines

correct answers 1 Correct answer

Guru , Mar 19, 2017 Mar 19, 2017

I doesn't still found these files yet.

You didn't look for them hard enough. Go to this page and at the very bottom you'll find the links: both for Windows and Mac.

Agree and download Bridge CS6 SDK for Windows (ZIP, 4.9 MB)

Agree and download Bridge CS6 SDK for Macintosh (DMG, 5.3 MB)

Anyway, here's a working code to illustrate you how to return the result and error from BridgeTalk message. (Based on the code you posted). I used the latest Illustrator and Photoshop.

#target illustrator

var width = "8

...

Likes

Translate

Translate
Guru ,
Mar 18, 2017 Mar 18, 2017

Copy link to clipboard

Copied

They are there, but the file names are a little different.

See the documentation in SDK: bridge_cs6_sdk_win_001\sdksamples\javascript\docs\index-all.html

18-03-2017 11-30-54.png

For example, SendArrayToPhotoshop.jsx in fact, is  SnpSendArray.jsx

However, their examples, (though they're well tested and always work) are a little bit confusing: you can make it much simpler. I recommend you to search for BridgeTalk on the InDesign scripting forum.  I posted a few examples here on my site.

Also, when I studied BridgeTalk (long ago in the times of CS3) I found that the sample code in the JavaScript Tools Guide CS3.pdf had a lot of mistakes and didn't work. (Don't know how the things are going in the latest edition.)

— Kas

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
community guidelines
Community Expert ,
Mar 19, 2017 Mar 19, 2017

Copy link to clipboard

Copied

Hi Kasyan Servetsky​,

thanks a lot for your answer. It was helpful, but not really helpful in detail. I doesn't still found these files yet.

And I found and have read your linked thread a few days ago. Useful, but unfortunately only at half.

I can call BridgeTalk and it does what it should be. But at the end I need the results in the first target engine.

Let me go into deep with an example.

The reason is: Illustrator is not good for measurements of the real area of pathItems or compoundPaths or groups of items. That's why I need a workaround.

  • select somthing in Illu
  • go to PS and open a exported file or insert the selection in a new created PS document
  • check the pixels which not have transparency and do some maths
  • give this informations back to Illu, e.g. as contents in a new textFrame (THIS PART doesn't works for me)

I do:

I select (by hand) an item or agroup of items (works)

I start my script in Illustrator from a palette or script menu. (works)

I call PS with BridgeTalk and work with the exported file or the clipboard information. (works)

I collect the informations that I want, and do same maths in PS. (works)

I can show the collected informations as an alert or as en editable edittext in a window. (works)

But it is not possible for me to give the collected informations back to illustrator and do the next steps in illustrator with these new informations.

Here is a very very simple example code. In this case I want to work with the variable w and h (from PS) in Illu after BridgeTalk is completed.

#target illustrator

_gotoPS();

// In know about asynchronous behavior in BridgeTalk

// this alert pop up too early, but it's only for showing the behavior

alert("How I can get variable w and h (values of arr[]) and use here in Illu?");

// do somthing in Illu with the variables from PS

// eg new TextFrames.add() with contents w and h

function _gotoPS(){

    // do something

    alert ("in Illustrator")

    // do something

var bt = new BridgeTalk();

    bt.target = "photoshop";

    // do something

    // be sure this is only a very simple example

    bt.body = 'app.documents.add("800px" ,"1000px", 72, "Temp");app.preferences.rulerUnits = Units.PIXELS;'+

    'var w = activeDocument.width;'+

    'var h = activeDocument.height;'+

    'var arr = [];'+

    'arr.push(w); arr.push(h); arr.push(w*h);'+

    'alert(arr[0]);'+

    'alert(arr[1]);'+

    'alert(arr[2]);'

    bt.onError = function(e){

        alert(e.body);

    };

    // because bt.onResult is not useful for me

    // because bt.onResult will also hold the variables here and I need them in Illu

bt.send();

};

Do you know a way how to do this?

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
community guidelines
Guru ,
Mar 19, 2017 Mar 19, 2017

Copy link to clipboard

Copied

I doesn't still found these files yet.

You didn't look for them hard enough. Go to this page and at the very bottom you'll find the links: both for Windows and Mac.

Agree and download Bridge CS6 SDK for Windows (ZIP, 4.9 MB)

Agree and download Bridge CS6 SDK for Macintosh (DMG, 5.3 MB)

Anyway, here's a working code to illustrate you how to return the result and error from BridgeTalk message. (Based on the code you posted). I used the latest Illustrator and Photoshop.

#target illustrator

var width = "800px";

var height = "1000px";

var resolution = "72";

var docName = "Temp";

CreateBridgeTalkMessage(width, height, resolution, docName);   

function CreateBridgeTalkMessage(width, height, resolution, docName) {

    var bt = new BridgeTalk();

    bt.target = "photoshop";

    var script = "DoSomethingInPS = " + DoSomethingInPS.toSource() + "\r";

    script += "DoSomethingInPS('" + width + "', '" + height + "', '" + resolution + "', '" + docName + "');";

    bt.body = script;

   

    bt.onResult = function(resObj) {

        DoSomethingInIlly(resObj.body);

        alert("Hi! This is the result returned by BridgeTalk - " +  resObj.body);

    }

    bt.onError = function(msg) {

        alert("Oops! Error: " + msg.body);

    }

    bt.send(100);

}

function DoSomethingInPS(width, height, resolution, docName) {

    app.displayDialogs = DialogModes.NO;

    app.documents.add(width, height, resolution, docName);

    app.preferences.rulerUnits = Units.PIXELS;

    var h = activeDocument.height;

    var w = activeDocument.width;

    var arr = [w, h, w*h];

    app.displayDialogs = DialogModes.ALL;

    $.writeln("Hey! This message is from Photoshop: w = " + arr[0] + ", h = " + arr[1] +", w*h = " + arr[2]);

    return arr;

}

function DoSomethingInIlly(btResult) {

    var reconstructedArray = btResult.split(",");

    $.writeln("Reconsrtucted the array sent from PF in the DoSomethingInIlly function");

}

At the end, the script reconstructs the array sent from Photoshop:

19-03-2017 15-49-07.png

Note line #13 -- you should be very careful with quotes here. I usually use combination of single and double quotes.

Now let's create an error condition:

19-03-2017 15-51-52.png

BridgeTalk returns quite an informative message:

19-03-2017 15-52-22.png

Regards,

Kas

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
community guidelines
Community Expert ,
Mar 19, 2017 Mar 19, 2017

Copy link to clipboard

Copied

Great.

Continue the Illu-script as a function in the bt.onResult function does the trick.

Thank you very much Kasyan Servetsky.

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
community guidelines
Community Expert ,
Dec 02, 2020 Dec 02, 2020

Copy link to clipboard

Copied

LATEST

Hi together,

came accross this old thread from 2017 today.

pixxxelschubser's issue is solved.

 

However, just to leave a note here.

The asked scripts are installed with every ESTK version.

 

From my German Windows 10 machine where Adobe ExtendScript Toolkit CC is installed.

The scripts can be found easily:

Applications (x86) > Adobe > Adobe ExtendScript Toolkit CC > SDK > Samples > javascript

 

ESTK SDK SampleScripts.PNG

 

Regards,
Uwe Laubender

( ACP )

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
community guidelines