1 Reply Latest reply on Aug 28, 2014 1:01 AM by Dirk Becker

    Call external apps from script

    mdegamo Level 1

      Hi,

       

      A want to be able to run an external application via script, just like how we do it in node.js via 'child_process' module. The reason for this is that I want my epub converted to mobi automatically after the export. The app that I will be calling is kindlegen.exe. Is this possible in extend script? I have tried the tutorials on ExternalObject but have no luck making it work.

        • 1. Re: Call external apps from script
          Dirk Becker Level 4

          The File object has an execute() method. That way you can launch any application or generated shell script.

          InDesign unlike other ExtendScript environments also has the doScript method to invoke platform specific scripting languages.

          These languages then have their way to invoke shell commands without a separate file.

           

          E.g. the following snippets reveal files in Finder/Explorer.

           

          app.doScript(
          "tell application \"Finder\"\r"
          + "reveal {"+list.join(", ")+"}\r"
          + "activate\r"
          + "end tell\r" ,
          ScriptLanguage.applescriptLanguage);
          

           

          or

           

          app.doScript(
          "CreateObject(\"WScript.Shell\").Run \"explorer /n,/e,/select,"+f.fsName+"\"",
          ScriptLanguage.visualBasic);