Hi Everyone,
Currently i am working with the automation for InDesign and Art. Using ESTK in my InDesign Script, i need to call the Illustrator and Photoshop applications by passing some arguments form InDesign to those applications simultaniously.
Simply, i need to work on these three applications at the same time.
Can anyone advice in this regard.
Thanks in advance
Thiyagu
I believe you would like to have a look at BridgeTalk. Here is a thread about where to find sources and samples:
http://forums.adobe.com/message/3309546
// Andreas
Hi Andreas,
Thanks for your advice. As i have already tested with Bridge Talk() but i am unable to acheive it.
Below are my exact requirement.
Currently i am working with InDesign CS3. I need to check whether the Object layered images preseneted in my InDesign document, if it is found i need to open the particular image (.ai or .psd) in the (Illustrator or Photoshop) applications and do some layer manipulation in it and do saveAs with different name. Finally i need to relink the image in InDesign.
I have written the script for InDesign, Illustrator & Photoshop seperately for the above stuff. The only thing i need to do is combine these scripts and make them intermediate. Finally i need to run this script from InDesign Scripts palette.
In a script, targetting the different applications is not work out i think so. Hence i tried with Bridge Talk() but facing difficulties on execution from ESTK.
My code:
---------------------------------------------------
#target InDesign-5.0
var doc = app.activeDocument;
var docLinks = doc.links;
var OLImage = [];
var OLayer = [];
var myCheck = 0;
for (e=0; e<docLinks.length; e++){
var myLink = docLinks[e];
var myGLayer = myLink.parent.graphicLayerOptions.graphicLayers;
if (myGLayer.length > 1){
for (g=0; g<myGLayer.length; g++){
if (myGLayer[g].currentVisibility != myGLayer[g].originalVisibility){
OLayer.push(myGLayer[g].name);
OLayer.push(myGLayer[g].currentVisibility);
OLImage.push(OLayer);
myCheck = 1;
}
}
if (myCheck == 1){
var myUpdatedImage = setLayerVisibility(myLink.filePath, OLImage);
alert (myUpdatedImage);
}
}
}
function setLayerVisibility(myFile, ObjLayers){
if (myFile.toString().match(/\.ai$/gi) != null){
//~ #target Illustrator-13.0
var doc = app.open(File(myFile));
var docPath = doc.path;
for (o=0; o<ObjLayers.length; o++){
if (ObjLayers[o][1])
doc.layers.getByName(ObjLayers[o][0]).visible = true;
else
doc.layers.getByName(ObjLayers[o][0]).remove();
}
var saveOptions = new IllustratorSaveOptions();
var aiCS4Doc = new File(docPath + "/" + doc.name.replace(".ai", "-b.ai"));
saveOptions.compatibility = Compatibility.ILLUSTRATOR14;
saveOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
doc.saveAs( aiCS4Doc, saveOptions );
return aiCS4Doc;
}
else if (myFile.toString().match(/\.psd$/gi) != null){
//~ #target Photoshop
var doc = app.open(File(myFile));
var docLayers = doc.layers;
var docPath = doc.fullName.toString().replace(/\.psd$/gi, "-b.psd");
for (p=0; p<ObjLayers.length; p++){
if (ObjLayers[p][1])
doc.layers.getByName(ObjLayers[p][0]).visible = true;
else
doc.layers.getByName(ObjLayers[p][0]).remove();
}
doc.saveAs (File(docPath));
return docPath;
}
}
Can you please guide me in this regard.
Thanks in advance
Thiyagu
In a script, targetting the different applications is not work out i think so. Hence i tried with Bridge Talk() but facing difficulties on execution from ESTK.
Please be specific -- what difficulties exactly?
Error messages or screenshots go a long way to helping to make your question clear.
What happens?
Hi John,
Thanks for your respond.
I tried to create new bridge talk and to merge my script within. When i run the script it doesn't show any error or warnings so.
Is there any specific application need to be selected in the ESTK dropdown during script execution?
Hence i am not clear with the bridge talk method i think so.
I hope this will make sense.
Thanks
Thiyagu
I tried to create new bridge talk and to merge my script within. When i run the script it doesn't show any error or warnings so.
Your posted script doesn't show any mention of BridgeTalk.
If your script is running in InDesign, it needs to send a BridgeTalk message to Illustrator, and then a seperate BridgeTalk message to Photoshop. That can be tricky, and you do not show us you are doing any of that!
Post the script as you have changed it, otherwise we are just guessing.
Is there any specific application need to be selected in the ESTK dropdown during script execution?
Hence i am not clear with the bridge talk method i think so.
Well, it depends on how you set up the script, but yes.It sounds like you want the script to begin in InDesign so you had better execute the script in InDesign. Though this is the same as your #target InDesign as the top of the script.
I hope this will make sense.
Actually, it is not really making sense at all, sorry.
Hi Hawkinson,
Thanks for looking into this. Actually i forgetted to attch my updated code.
Using bridge talk i can able to call the other applications (Illustrator & Photoshop) and to give simple alerts. But i am unable to pass the arguments (array, string) to those applications via BT.
In the below code the variable 'myFile' contains the file path as string, i have tried to alert this file path in photoshop but it doesn't show anything.
________________________
#target InDesign
var myFile = myLink.filePath;
var bt = new BridgeTalk;
bt.target = 'photoshop';
bt.body = "alert (myFile);"
bt.onResult = function(resObj) {
var myResult1 = resObj.body;
$.writeln("myResult1 = " + myResult1);
return myResult1;
}
bt.send();
Can you please check and help me in this regard.
Thanks & Regards
Thiyagu
Using bridge talk i can able to call the other applications (Illustrator & Photoshop) and to give simple alerts. But i am unable to pass the arguments (array, string) to those applications via BT.
In the below code the variable 'myFile' contains the file path as string, i have tried to alert this file path in photoshop but it doesn't show anything.
BridgeTalk does not pass variables! The only thing that is passed is the bt.body string. You must pass any variables yourself. Instead of:
var myFile = myLink.filePath;
bt.body = "alert (myFile);"
you should use something like:
bt.body = "alert (" + myFile.toSource() + ");";
or perhaps
bt.body = "var myFile = "+myLink.filePath.toSource()+"; alert(myFile);"
Etc.
North America
Europe, Middle East and Africa
Asia Pacific