1 Reply Latest reply on Apr 29, 2013 2:28 PM by mk403

    How do I get the Application object for a running instance of InDesign Server from VBScript and C++

    mk403

      I have a running instance of InDesign Server CS6 which I launched using the following command:

      "C:\Program Files\Adobe\Adobe InDesign CS6 Server x64\InDesignServer.com" -port 12345

       

      I tried running the following VBScript file to access this running instance:

      Set myApp = WScript.GetObject("configuration_12345")

      myApp.ConsoleOut("Foo")

      Set myApp = Nothing

       

      But I get this error (launched using 64-bit wscript.exe):

      ---------------------------

      Windows Script Host

      ---------------------------

      Line:          1

      Char:          1

      Error:          File name or class name not found during Automation operation

      Code:          800A01B0

      Source:           Microsoft VBScript runtime error

       

      I also tried to access this instance using C++ COM:

      int _tmain(int argc, _TCHAR* argv[])

      {

                HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);

                if (FAILED(hr))

                {

                          printf("COM init failed\n");

                          return 0;

                }

       

                IDispatch* pUnk = NULL;

                hr = ::CoGetObject(L"configuration_12345", NULL, __uuidof(IDispatch), (void**)&pUnk);

                if (SUCCEEDED(hr))

                {

                          pUnk->Release();

                          pUnk = NULL;

                }

                ::CoUninitialize();

                return 0;

      }

       

      But, CoGetObject returns 0x800401e4 (MK_E_SYNTAX).

       

      However, if I use the "helloworld-csharp-com" sample, using "configuration_12345" as the config, it works fine. Why is it not working with VBScript and C++?

       

      I'm running Windows 8, 64-bit, IDS CS6 8.0

        • 1. Re: How do I get the Application object for a running instance of InDesign Server from VBScript and C++
          mk403 Level 1

          I believe I figured out what was going wrong with my C++ program. My InDesignServer process was running with Administrator-level privileges, but my C++ program was running as at the normal privilege level. So, my C++ program was not able to see the "configuration_12345" object because it didn't have sufficient privileges to see the object. I have it working now and I no longer get errors.

           

          Oddly, I was not able to get my VBScript to work regardless of the privilege level it was running at. But, I did find a workaround that was good enough for my purposes. If I change the first line from this:

               Set myApp = WScript.GetObject("configuration_12345")

           

          To this:

               Set myApp = WScript.CreateObject("InDesignServer.Application")

           

          "myApp" ends up being set to my currently running instance of InDesign Server. I don't know what happens if you have more than one instance of InDesign Server running, but, for my purposes, I'll only ever have one instance running at a time.