Copy link to clipboard
Copied
var bt = new BridgeTalk(); bt.target = "photoshop"; bt.body ="app.open(new File("+app.selection[0].graphics[0].itemLink.filePath+"));"; bt.onResult = function( inBT ) { result = eval( inBT.body ); } bt.onError = function( inBT ) {alert(inBT.body); } bt.send(8); I want to open selection image
Copy link to clipboard
Copied
Hi ahmetö66264486,
does this works for you?
var file2open = app.selection[0].graphics[0].itemLink.filePath;
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = "app.open(new File('" + file2open + "'));";
bt.onResult = function( inBT ) { result = eval( inBT.body ); };
bt.onError = function( inBT ) { alert(inBT.body); };
bt.send(8);
Have fun
Copy link to clipboard
Copied
Many thanks 🙂 was very helpful.
Copy link to clipboard
Copied
Can I send it in function?
Copy link to clipboard
Copied
like: bt.body = ofile();
Copy link to clipboard
Copied
ahmetö66264486 schrieb
like: bt.body = ofile();
Sure. But in bt.body you always have to work with strings.
var file2open = app.selection[0].graphics[0].itemLink.filePath;
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = "openFileInPS = function openFileInPS( file2open ) { app.open(new File('" + file2open + "')); };\ropenFileInPS('" + file2open + "');";
bt.onResult = function( inBT ) { result = eval( inBT.body ); };
bt.onError = function( inBT ) { alert(inBT.body); };
bt.send(8);
Have fun
Copy link to clipboard
Copied
do you still have problems?
Copy link to clipboard
Copied
Thank you for your help. But there is one more question. Example: function ahmet(){ //Scripts } bt.body=".+ahmet()+";
Copy link to clipboard
Copied
question one: answered
question two: answered
question three:
#target indesign
var bt = new BridgeTalk();
bt.target = "photoshop";
bt.body = "alertInPS = " + alertInPS.toString() + "\ralertInPS();";
bt.onResult = function( inBT ) { result = eval( inBT.body ); };
bt.onError = function( inBT ) { alert(inBT.body); };
bt.send(8);
function alertInPS() {
alert("Hello PS");
// do something else
}
also answered
Have fun