5 Replies Latest reply on Sep 10, 2018 12:40 AM by fabianr60626509

    Call JSX-Scripts from the InDesign Script Panel from within VBA?

    fabianr60626509

      Hi there

       

      Let’s say I have written a "test.jsx" (located at C:\Users\Username\AppData\Roaming\Adobe\InDesign\Version 13.0\de_DE\Scripts\Scripts Panel\):

       

      var myDocument = app.documents.item(0);
      var myTextFrame = myDocument.textFrames.add();
      myTextFrame.geometricBounds = ["20mm", "20mm", "100mm", "100mm"];
      myTextFrame.contents = "Hello World";
      

       

      I also have an Excel document "test.xlsm" containing a button. This button calls my VBA macro. This macro opens InDesign and „test.indd“ (like the excel doc located at C:\Users\Username\Documents\):

       

      Sub sayHelloToWorld()
           Set myInDesign = CreateObject("InDesign.Application.CC.2018")
           myInDesign.Activate
           myInDesign.Open (ThisWorkbook.Path & "\test.indd")
      End Sub
      

       

      Here I’m struggling to find a way to tell InDesign to run "test.jsx". Something like this:

       

      myInDesign.DoScript(„test.jsx“)
      

       

      My goal is to just click on the button in my Excel document, the InDesign document would open and print „Hello World“. I want my JS script in a separated jsx file if that’s possible and I don’t want to run test.jsx as a startup script. I would prefer a pure VBA solution as I'm completely unexperienced with shell scripting.

       

      I added the InDesign Reference like described in https://forums.adobe.com/thread/2194605 but I don’t even know what that’s good for. It seems to me that it is possible in Apple Script (https://forums.adobe.com/thread/2209803) but I don’t manage to translate that into VBA.

       

      Using Windows 10 Pro (10.0.17134), InDesign 13.1 x64, Excel 14.0.7212.5000 (32-bit)  [Office 2010]