Skip to main content
YaoyongYu
Known Participant
June 15, 2015
Answered

I want to know that how to use 'Bridge Talk'.

  • June 15, 2015
  • 1 reply
  • 2788 views

var bt = new BridgeTalk;

     bt.target = "photoshop";

     var myScript = WIN.toString() ;

     bt.body = myScript;

     bt.send();

  

function WIN(){

var isDone, win, windowResource;

isDone = false;

windowResource = "palette{\

orientation: 'column', \

alignChildren: ['fill', 'top'],  \

preferredSize:[300, 130], \

text: 'ScriptUI Window - palette',  \

margins:15,  \

frameLocation:[1200,-10],\

   }"

win = new Window(windowResource);

win.show();

app.bringToFront()

}

JJMack‌ 

This topic has been closed for replies.
Correct answer I have gone

//New Bridgetalk

var bt = new BridgeTalk();

//Target application

bt.target = "bridge";

//Script to execute on target application

bt.body = /*script to execute*/;

//Results  if anything is to be returned

bt.onResult = function( inBT ) { result = eval( inBT.body ); }

//If anything goes wrong, error message

bt.onError = function( inBT ) {alert(inBT.body); }

//Send the command with a timeout in seconds

bt.send(8);

1 reply

I have goneCorrect answer
Inspiring
June 15, 2015

//New Bridgetalk

var bt = new BridgeTalk();

//Target application

bt.target = "bridge";

//Script to execute on target application

bt.body = /*script to execute*/;

//Results  if anything is to be returned

bt.onResult = function( inBT ) { result = eval( inBT.body ); }

//If anything goes wrong, error message

bt.onError = function( inBT ) {alert(inBT.body); }

//Send the command with a timeout in seconds

bt.send(8);

YaoyongYu
YaoyongYuAuthor
Known Participant
June 15, 2015

thank u.  .i think it's more better if you give me a sample

Inspiring
June 15, 2015

Here is an example of getting a list of selected files From Bridge any Folders are ignored.

alert(getSelectedFilesFromBridge().join('\n'));

function getSelectedFilesFromBridge(){

if (!BridgeTalk.isRunning("bridge")) {

BridgeTalk.launch("bridge");

var err = ["Bridge was not running, please run this script again\n Bridge will now be started."];

return err;

}

fileList = new Array();

var bt = new BridgeTalk();

bt.target = "bridge";

bt.body = "var f = " + Script.toSource() + "; f();";

bt.onResult = function( inBT ) { fileList =eval( inBT.body );}

bt.onError = function( inBT ) { alert(eval(inBT.body)); }

bt.send(8);

return fileList;

};

function Script(){

var sels = app.document.selections;

var Files=[];

if(!sels.length) Files.push("No Files Selected");

for(var z =0; z < sels.length;z++){

if(sels.spec instanceof File) {

Files.push(sels.spec);

    }

}

return Files.toSource();

};