1 Reply Latest reply on Dec 10, 2014 4:27 AM by Dirk Becker

    https://forums.adobe.com/message/6999731

    AdobeScripting

      Hello,

       

      why do we get the following exception, when a user closes "InDesign CC"?

      "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"   

      When the mentioned exception occurs, then InDesign sadly won't start programmatically.

       

      Respectively, should we change the code in the method OpenIndesignAndPrint() ?

       

      static InDesign.Application application;  
        
      InDesign.Document OpenIndesignAndPrint()  
      {  
        if (application == null)    
          {  
            // works fine. If InDesignCC isn't started, then it gets programmatically started  
            application =  (InDesign.Application)this.COMCreateObject("InDesign.Application");  
          }  
          else  
          {  
            // A User has already started InDesign manually. So don't start InDesignCC a second time.  
          }  
      
          InDesign.Document doc = (InDesign.Document) application.Open(sPath, true);   
        
          // here code for printing programmatically  
      }  
        
      Main()  
      {  
        OpenIndesignAndPrint(); // works fine. InDesignCC will get programmatically started (if a user hasnÄt started it yet)  
        OpenIndesignAndPrint(); // works fine. The code internally "knows" that InDesignCC is already started.  
        
        // however, if a user closes "InDesign CC", then the following exception occurs when programmatically executing OpenIndesignAndPrint()  
        // "The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)"      
        // Why doesn't OpenIndesignAndPrint() open InDesignCC programmatically?  
      } 
      
        • 1. Re: https://forums.adobe.com/message/6999731
          Dirk Becker Level 4

          Your COMCreateObject creates a local proxy object within your execution environment.

          When the matching remote object ceases to exist, you have to create a new local proxy and that way relaunch the remote process.

          When you catch that error you should

          - decode the multiple possible causes such as RPC_E_SERVER_DIED

          - create a new object when appropriate (not when the object is on a remote machine and your network is down, cable is removed, the user has uninstalled InDesign ;-) and so forth)

          - retry the command

          - eventually use a loop and give up with a warning after n attempts