4 Replies Latest reply on Sep 6, 2012 10:35 PM by Bill joy

    Applescript to Javascript

    Bill joy Level 1

       

      I have an Applescript that I need to convert it into  Javascript.

      To create Indesign instancs in applescript i use

      tell application "Adobe InDesign CS5" statement

      How create Indesign instancs in JavaScript

      or what is equivelent statement of ( tell application "Adobe InDesign CS5" ) in Java Script

       

      Using COM I create Indesign Instance like

      #include "indesign.h"

      INDESIGN::_Application oApplication;   

      if(oApplication.CreateDispatch(L"InDesign.Application") ==0)

      {

          AfxMessageBox(L"Dispatch is not created");

      }


      How create Indesign instance using java Script ?


      Thanks.

        • 1. Re: Applescript to Javascript
          MrTIFF Level 3

          In JavaScript (ExtendScript), "app" (InDesign) is always available.  See the Sample scripts in your InDesign Scripts Panel folder.

          • 2. Re: Applescript to Javascript
            Bill joy Level 1

            Thanks Stephen0218 for reply

             

            Yes

            "app" (InDesign) is always available In JavaScript (ExtendScript).

            These script run sucessfully when i put these script in C:\Program Files\Adobe\Adobe InDesign CS5.5\Scripts

             

            and to run these script use Scripts panel (choose Window > Utilities > Scripts), then double-click the script name in the Scripts panel in indesign application.But In this case first i start indesign application and then choose Window > Utilities > Scripts then double-click the script name in the Scripts panel.

             

            If I run (or debug) these script in any java script editor like ExtendScript ToolKit 3.6 then it give error undefined "app".

             

            But I want to creat such java script.When I run or (debug) my JavaScript in any javaScript tool like ExtendScript ToolKit 3.6 then Indesign application should start, like in Apple Script when i run my apple script

             

            tell application "Adobe InDesign CS5.5"

            set myDocument to make document with properties

            end tell

             

            in apple script editor, Indesign Application start(create) sucessfully.

            So I need to creat application object (or instance) say "app".

             

            Thanks


            • 3. Re: Applescript to Javascript
              CarlosCanto Adobe Community Professional & MVP

              you were given an answer in your previous (duplicate) thread

              http://forums.adobe.com/thread/1061428?tstart=0

               

              follow that or, in the ESTK select InDesign as your target application. Click on the down arrow you see next to ExtendScript Toolkit CS4.

              estkActivate.PNG

              • 4. Re: Applescript to Javascript
                Bill joy Level 1

                Thanks CarlosCanto for reply

                 

                I am a new developer and want to create indesign application.

                First I explane you, What i want to do?

                I want to create an Indesign application for both mac and window os.

                First I use COM and crate indesign application

                 

                #include "indesign.h"

                INDESIGN::_Application oApplication;   

                if(oApplication.CreateDispatch(L"InDesign.Application") ==0)

                {

                     // Dispatch is not created;

                }

                But COM is not supported on mac so i want to use JavaScript

                I am using Qt to develop my application and i want to create a java script .
                When I run my JavaScript on window  then Indesign application should start .

                In my post I write about ExtendScript ToolKit 3.6, but i do not want to use this tool.


                For example on mac in Apple Script when i run my apple script

                 

                tell application "Adobe InDesign CS5.5"

                set myDocument to make document with properties

                end tell

                 

                in apple script editor which is inbuild with mac, Indesign Application start(create) sucessfully.

                I want to use javaScript editor inbuild with window.

                Like in applescript there is no need to put the script in  /Users/<username>/Library/Preferences

                /Adobe InDesign/Version 7.5/<locale>/Scripts

                Simply when i run apple script application create. I want to such using java script.

                I do not want to put my script C:\Documents and Settings\<username>\Application Data

                \Adobe\InDesign\Version 7.0\<locale>\Scripts      

                to start indesign application

                 

                http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/In DesignScripting/InDesign-ScriptingTutorial.pdf

                Establish communication with the InDesign application object:

                AppleScript :   tell application "Adobe InDesign CS5"

                VBScript     :    Set myInDesign = CreateObject("InDesign.Application")

                JavaScript   :    Refer to the application as app.

                 

                plz give a simple java script (.js) file example which create Indesign Application (instance) , when i run my java script in any java script editor, No need to put script /Users/<username>/Library/Preferences/Adobe InDesign/Version 7.5/<locale>/Scripts and run script after run indesign.

                Like in VB to create indesign object we use CreateObject("InDesign.Application"). In javascript how create object of InDesign Application.

                 

                 

                 

                Thanks