Launch one CS app from another
RorohikoKris Jan 9, 2012 2:40 AMHi all,
Newbie alert - sorry!
I am currently stuck on something that seems simple, but I cannot get it to work - it's about coordinating between multiple CS apps.
I want to cause one Creative Suite app (e.g. Photoshop) open a certain document (say a JPEG file) while running a CS Extension running in another Creative Suite app (e.g. Illustrator).
I first naively assumed I could just use the app property of the Photoshop class (i.e. 'com.adobe.csawlib.photoshop.Photoshop.app') from an extension hosted by Illustrator, but I am not having much luck. One possible cause is that Photoshop is not necessarily running. When I try to refer to Photoshop.app while 'inside' an Illustrator extension, I do get an object back, but it's full of nulls and empty member variables - it's not properly instantiated, and as soon as I try to refer to something 'in' it (e.g. Photoshop.app.open(...)), a null exception is being thrown.
I've tried pre-launching Photoshop manually, but that does not seem to help, and any which way, I want to automatically launch Photoshop if it has not been launched yet.
The next thing I tried was to use an embedded ExtendScript - when one is using ExtendScript, it's fairly simple to talk to other apps in the Creative Suite. There are objects called 'photoshop', 'illustrator' and so on, and there is BridgeTalk.
But when I call my ExtendScript from within ActionScript using the HostObject, it looks like I am missing all of the normal 'infrastructure' I've grown to expect when running ExtendScript. I suspect it's because I am in a separate engine that does not have the stuff I want to access.
Then I tried to force things - I noticed the sample code that runs an ExtendScript in ActionScript has a phrase:
var myBridgeScript : HostObject = HostObject.getRoot(HostObject.extensions[0]);
and HostObject.extensions[0] is something like 'com.adobe.illustrator'. So I tried other strings here (e.g. running inside Illustrator, I tried 'com.adobe.photoshop') - no luck. Got a null in myBridgeScript.
I looked at the CSXSEvents - but as far as I understand those would only help me when Photoshop is already running - Bob Stucky's cookbook article
http://cookbooks.adobe.com/post_Inter_Application_Communication_with_the_Creative-18456.ht ml
ends with: 'Possible extensions would be to launch Photoshop, if necessary, using Air's NativeProcess'. That sounds like bad news, and seems to indicate I'd have to go search for the Photoshop app path the hard way (keeping in mind that some people install their Creative Suite in odd places, so it's not always in '/Applications/Adobe Photoshop CSsomething' or 'C:\Program Files\Adobe\Adobe Photoshop CSsomething').
Now, I can go do this the complicated way (calling down to the underlying operating system, try to find the correct Photoshop app (there might be more than one), and launch the document through the OS) - but I was really expecting there would be a simple magical trick to do it in a much more direct manner - it's clear the Creative Suite apps know about each other, so I was hoping to find a way to rely on their internal smarts to launch documents from one CS app into another CS app.
Any ideas?




