Is it possible to have these two programs communicate? Or will I have to use strictly the CS3 programs or CS5 programs? I simply want to click on a link in InDesign and have it open in Illustrator so I can edit it. Everything I've read hasn't really touched on interoperabilty of Bridgetalk between CS versions. Thanks.
Nate
Well editOriginal() would open the file in Acrobat, since I'm dealing with PDFs most of the time. I was hoping to open them in Illustrator. I'd rather not change my default application preferences to have PDFs open in Illustrator every time. I guess I could use Acrobat Pro to manipulate the files.
But if I wanted to do this, just to see how it's done, how would using File.execute() tell Illustrator to open the file? I'll search around a bit and see what I can find.
Nate
Sorry, I didn't understand you wanted to open in a non-default app.
File.execute() has the same problem, it is functinoally equivalent to editOriginal() (though the file need not be a link).
You'll have to use BridgeTalk, VB, or AppleScript.
In re BridgeTalk, have you tested it? I think that's what you should do instead of asking if it works...
Well I initially started out by searching these forums, and trying out some code that I found. Most of the code was for InDesign -> Photoshop, which was fine to make sure everything worked. However, nothing would work. It's like InDesign wasn't communicating with Photoshop. So I figured I better check here and make sure CS3 and CS5 can work together via BridgeTalk before I got too deep. But if you're saying CS3 and CS5 are capable of interaction I'll continue searching and see what I can come up with. I'm not trying to have someone write this for me, just wanted to make sure it was possible before I wasted too much time.
Nate
I've never tried it myself, but BridgeTalk is supposed to default to the same version as the sender if possible, otherwise the highest available version number.
If you have multiple versions, you can add version number to the target.
Something like (JS)
var bt = new BridgeTalk()
bt.target = "illustrator-13.0"; // (I think that's the correct version for CS3, but am really guessing)
Let us all know if it works!
Regards
Mark, InDesign CS3 only has Edit Original, no Edit With. We have some software here that for the time being is only compatible with CS3 templates. Eventually that will get updated to work with CS5, so at that point this problem/script would go away. But if I can figure out a quick script to open the link in Illustrator I'm going to use that until we upgrade, instead of trying to hunt down the original art in a folder with 150,000+ files.
Nate
Nate, Im at home now where my little mac has CS2 & CS5… This opened a selected PDF in AI CS5 from ID CS2 ( if it was already running )… If AI CS5 was not running bridgetalk did NOT launch it like I would normally expect… The message just queues until I launch it… Strange? I tested with both versions of AI running too and it was OK. I had the PDF selected with the direct selection tool…
#target indesign
indesignMain();
function indesignMain() {
if ( app.documents.length == 0 ) { return; }
var doc, pdfPath, sel, script;
doc = app.activeDocument, sel = doc.selection;
if ( sel.length == 1 ) {
pdfPath = decodeURI( sel[0].itemLink.filePath );
script = illustratorEditPDF;
script += '\rillustratorEditPDF("' + pdfPath + '");';
btMessaging( 'illustrator-15.0', script );
}else{
alert( 'Have 1 item selected?' );
};
};
function btMessaging( targetApp, script ) {
var bt = new BridgeTalk();
bt.target = targetApp;
bt.body = script;
//bt.onResult = function( inBT ) {};
//bt.onError = function( inBT ) {};
bt.send( 5 );
};
function illustratorEditPDF( pdf ) {
var doc, uIL;
uIL = app.userInteractionLevel;
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
app.preferences.PDFFileOptions.pDFCropToBox = PDFBoxType.PDFMEDIABOX;
app.preferences.PDFFileOptions.pageToOpen = 1;
doc = app.open( File( pdf ), DocumentColorSpace.CMYK );
app.userInteractionLevel = uIL;
};
Wow Mark that looks great! Thank you so much. Only problem is for some reason it's not working on my machine.
I've been stepping through the code to see where it might be having issues. It will run the indesignMain function, then switch to the btMessaging function, then go back to the indesignMain function and finish. I've been putting some alerts in to see if it's getting the PDF path (yes), the correct target app (yes), and the correct script to run (yes), but nothing happens in Illustrator. One thing that seemed strange is that it never enters the illustratorEditPDF function, but I'm not 100% sure on how BridgeTalk uses the line 'script = xxxxx' so perhaps that is normal. For fun I tried running the script in ESTK CS5, and at the bottom of the window it says 'Execution finished. Result: undefined'. So now I'm wondering if something might be wrong with my machine.
Nate
Im at work where I don't have 2 installs… It was a little weird for me in that if AI CS5 was not already running the message did not launch like it should… Just sat waiting I thing… When I did launch AI it open the file right away…? Odd… I commented out the call backs as they crashed my id every time… How I check this stuff is use…
$.write( script );
Just before the bt.send( 5 ); If the console result cut and paste to a new ESTK window = working script
script = functionName; just strings it?. I find it easier in most cases to just pass a whole script as one string…
One thing that seemed strange is that it never enters the illustratorEditPDF function, but I'm not 100% sure on how BridgeTalk uses the line 'script = xxxxx' so perhaps that is normal.
This is normal. The function is never evaluated. Instead, it is converted to a string and that string is passed via BridgeTalk.
I feel guilty for trying to test it but I think VB would be way easier
I would do it with AppleScript...
Ok, the script to string part makes sense now. Thanks for making that make sense guys.
Mark, I tried to do what I think you were talking about, (cutting and pasting the result of the console into a new ESTK window). I get this as a result in the console:
function illustratorEditPDF( pdf ) {
var doc, uIL;
uIL = app.UserInteractionLevel;
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
app.preferences.PDFFileOptions.pDFCropToBox = PDFBoxType.PDFMEDIABOX;
app.preferences.PDFFileOptions.pageToOpen = 1;
doc = app.open( File( pdf ), DocumentColorSpace.CMYK );
app.userInteractionLevel = uIL;
}
illustratorEditPDF("C:\test\ro1jr1xs.31g.PDF");undefined
If I try running that as a standalone script, I get errors about the UserInteractionLevel (probably because the target is InDesign still?). BUT, if I paste the result into ESTK CS5, change the target to be Illustrator 5, change the back slashes to forward slashes in the file path, and run it, it opens the file in Illustrator properly. Do I have to do something with the slashes in the the main script then?
illustratorEditPDF("C:\test\ro1jr1xs.31g.PDF");undefined
If I try running that as a standalone script, I get errors about the UserInteractionLevel (probably because the target is InDesign still?). BUT, if I paste the result into ESTK CS5, change the target to be Illustrator 5, change the back slashes to forward slashes in the file path, and run it, it opens the file in Illustrator properly. Do I have to do something with the slashes in the the main script then?
At a minimum, you must double backslashes in string literals. Because Javascript interprets "\t" as a tab character. So you'll need "C:\\test\\roljrlxs.31g.PDF".
Try this way… Again it worked here…
#target indesign
indesignMain();
function indesignMain() {
if ( app.documents.length == 0 ) { return; }
var doc, pdfPath, sel, script;
doc = app.activeDocument, sel = doc.selection;
if ( sel.length == 1 ) {
pdfPath = File( sel[0].itemLink.filePath );
script = illustratorEditPDF;
script += '\rillustratorEditPDF(' + pdfPath.toSource() + ');';
btMessaging( 'illustrator-15.0', script );
}else{
alert( 'Have 1 item selected?' );
};
};
function btMessaging( targetApp, script ) {
var bt = new BridgeTalk();
bt.target = targetApp;
bt.body = script;
bt.send( 5 );
};
function illustratorEditPDF( pdf ) {
var doc, uIL;
uIL = app.userInteractionLevel;
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
app.preferences.PDFFileOptions.pDFCropToBox = PDFBoxType.PDFMEDIABOX;
app.preferences.PDFFileOptions.pageToOpen = 1;
doc = app.open( File( pdf ), DocumentColorSpace.CMYK );
doc.bringToFront();
app.userInteractionLevel = uIL;
};
Still no luck. I think something is up with BridgeTalk. I changed the timeout value in bt.send(); from 5 to 45, and the script just zips right through. So since it's not waiting 45 seconds before it finishes, that must mean the target is processing the message, but not doing anything with it, right? Or perhaps the message isn't even getting to the target?
Mark, what version of ESTK are you using? I'm trying to get it to work in 2. I don't have Illustrator listed in the targets drop down though. Could that be part of the problem?
Works fine on another Windows 7 machine in the area. This time it was InDesign CS4 with Illustrator CS5. My machine must be messed up. Perhaps it's time for a re-image. I'm going to mark this as answered, but if I figure out what is causing my machine to not work I'll update this thread. Thanks for all the help Mark and John.
I just ran
BridgeTalk.getTargets();
in ESTK 2, and the console reports back "bridge, estoolkit, indesign, stockphotos". So for some reason it's not seeing any CS5 apps. However, when I run the same code in ESTK 5, I get "fireworks, ame, bridge, devicecentral, dreamweaver, estoolkit, exman, flash, flashcatalyst, illustrator, indesign, photoshop, stockphotots, switchboard". So there are many more choices. Not sure if that will help but I figured I should mention it.
Nate
North America
Europe, Middle East and Africa
Asia Pacific