Skip navigation
Currently Being Moderated

Inter-app communication

Aug 5, 2011 2:33 PM

hi,

I have an CS extension for indesign, illustrator and photoshop. The extension works fine if invoked in the respective application. But from InDesign, can I invoke a file open request for say PhotoShop? That is, I need the user to stay within one application and open/process files in other applications. My panel has Illustrator files and photoshop file's path available to it. I have to fire file open and other file handling events to other apps. possible?

My client has a need to work with indesign , photoshop and illustrator files. Even though they have one extension installed for all the 3 apps, they have to go back and forth between the apps to work with all their files. A one stop place will be handy for us.

 

thanks for any help on this front.

 
Replies
  • Currently Being Moderated
    Aug 5, 2011 2:45 PM   in reply to Rums

    This shows 1 method using sockets.

     

    http://cookbooks.adobe.com/post_Inter_Application_Communication_with_t he_Creative-18456.html

     

     

    You can also use CSXSEvents to achieve the same goal so long as you are communicating between extensions in host applications that support CSXS.

     

    I would require less code to use CSXSEvents if the host support isn't an issue for you.

     

    An example of sending CSXSEvents between extensions in host applications is here:

     

    http://cookbooks.adobe.com/post_Synchronizing_Extension_Data_Models_be tween_CS_App-19196.html

     

    This one isn't doing exactly the same sort of thing - it takes an object that's in an extension in one host app, serializes it, sends it to an extension in a different host app, and then reconstitutes the object at the destination.

     

    Regards

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 8, 2011 4:32 PM   in reply to Rums

    Glad you'll find the model synchronization handy!

     

    With Extendscript, there's BridgeTalk. Unfortunately, BridgeTalk was never intended to work via the mechanisms that support ActionScript. It's pretty much broken for two-way messaging. You can send a BridgeTalk message, it will get to the target application and execute. However, your extension will get no return communication to know if the call worked or not. Meanwhile, you can use BridgeTalk to find out if an application is running, and launch it as well.

     

    In your case, you'll need to write an extension that will run on application startup, and set up listeners. You'll pass the file path in the xml payload of the CSXSEvent.

     

    I probably wasn't clear on "turning off the listener". In the case of synchronizing models, we're creating a new instance of the model in the destination application every time the models sync up. We then transfer the properties of that model instance to the existing model. When we're done, there's that newly created model instance that we don't need. It has (as a part of instantiation) a listener as well. Because of that listener, it will never get garbage collected and would be a memory leak.

     

    In your case, you'll just be sending CSXSEvents back and forth, that's not a problem.

     

    As for starting the target application, I would recommend taking a look at this cookbook by Zak Nelson.

     

    http://cookbooks.adobe.com/post_Communicating_between_JavaScript_and_t he_Creative-17383.html

     

     

    You'll want to create a function that tests to see if your target app is running, and if not - to launch it. Once it returns, you can use CSXSEvents to find out when the application is ready.

     

    Does that process make sense??

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2011 3:08 PM   in reply to Rums

    I was able to communicate to jsx from CS SDK using HostObject given in the cook book you have mentioned.

     

    var  jsxInterface:HostObject = HostObject.getRoot(HostObject.extensions[0]);

     

     

    But every command, I execute using it seems to be in context to the host object under which the extension runs.

    Same with CSXSInterface.instance.evalScript.

     

    a) How do I find all the target hosts the extension is built with (for example: photoshop, Illustrator and InDesign). Is there a way to query the manifest to do so?

     

    You could read the manifest; however since you're writing the extensions I'd just hard code them.

     

     

     

    b) If I get a list of all those target apps, how do I auto-launch them in order to use CSXSEvents? Is it possible to auto-launch all target applications?

     

    You can't do that directly from CSXS. You can use the host object to call BridgeTalk.launch( target );

     

     

     

    c) If I can launch them using jsx, I can send the file path as a parameter to that launch jsx call itself. Does that mean, I can get away from using CSXSEvent?

     

    I want to open a photoshop file from my extension running inside Indesign.

     

    You can if you don't care about getting a reply back from BridgeTalk (to know if it worked or not).

     

     

    d) If I have to go the CSXSEvent route (in global scope) and  if 2 apps. support the same file type, how do I block a particular file format from going to a target application.

     

    You'd have to put the target app in the xml, and filter on the receiver side.

     

     

     

    Can you please provide examples if any? My goal is to target a particular CS app and send it a file path requesting a file open command.  I am coming from the switchboard, patchpanel world and inter-app communication seemed so much easier there.

     

    I don't have any examples of this specifically, but I would think the answers above should help clear things up for you. The bottom line on inter-app communications is that this first release of CSSDK is limited. The switchboard/patchpanel world was BridgeTalk on steroids. With the CSSDK we got the performance from AS that wasn't there before. As for Interapp communications, we are well aware of the limitations of the current release. You can bet we are working on it.

     

     

     

     

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 1, 2013 12:19 AM   in reply to Bob Stucky

    hi,

     

    I'm trying to send a simple string using CSXSEvent, like below, but the xml payload returns null:

     

    var data:XML= new XML();

    data = <project></project>;

    data.@project = currentView;

     

    var ev:CSXSEvent = new CSXSEvent("leaveAppEvent", CSXSEventScope.GLOBAL, XML(data))

    CSXSInterface.instance.dispatchEvent(ev);


    Although I receive the data in the other app, data outputs null:

     

    CSXSInterface.instance.addEventListener("leaveAppEvent", refreshView);

     

    protected function refreshView(event:CSXSEvent):void

    {

           trace("ExchangeDataTest  refreshView scope: " + event.scope);//outputs GLOBAL

           trace("ExchangeDataTest  refreshView data: " + event.data);//outputs null

    }

     

    Or is the data property not meant to be used like this?

     

    Thanks,

    Jeff.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 1, 2013 4:52 AM   in reply to JeffWinder

    oh silly, xml should of course have a root element, this works:

    var initXML:XML = <root><projects></projects></root>

                                            initXML.@test = "yay"

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points