#target indesign-5.0
#targetengine "session"
var myResult2 = infoFromPS();
$.writeln("myResult2 = " + myResult2);
function infoFromPS() {
var bt = new BridgeTalk;
bt.target = "photoshop";
bt.body = "app.colorSettings;"
bt.onResult = function(resObj) {
var myResult1 = resObj.body;
$.writeln("myResult1 = " + myResult1);
return myResult1;
}
bt.send();
}
#target indesign-5.0
#targetengine "session"
function infoFromPS() {
var bt = new BridgeTalk;
bt.target = "photoshop";
bt.body = "app.colorSettings;"
bt.onResult = function(resObj) {
var myResult = resObj.body;
$.writeln( "BridgeTalk result = " + myResult );
doSomethingNow( myResult );
}
bt.send();
}
function doSomethingNow( result ) {
if (result != "ISO Web Coated") {
alert( "Color Settings in Photoshop are set to \"" + result + "\"");
}
}
infoFromPS();
Hi Bob & Kasyan,
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 have 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.
Below is 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.ILLUSTRATOR13;
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
North America
Europe, Middle East and Africa
Asia Pacific