2 Replies Latest reply on Aug 14, 2015 5:15 AM by Jeffkr

    Determine InDesign Version (applescript to javascript equivelent)

    Jeffkr Level 1

      I have next to no knowledge of javascript, nor where to go for help? I have a very simple Applescript that I would like to convert into javascript.

       

      For starters, does anybody know the following javascript equivalent for this line of code:

       

      set myVersion to version of application id "com.adobe.InDesign" as string

       

      The other part of the script I might be able to figure out on my own. Except at some point I'll have to find a PC user to provide the file path to the InDesign's Preference folder's "en_US" folder.

       

      Using a File.openDialog(); would get around not knowing the hardcoded file path, but the defeats the purpose and efficiency of the script. I want the end user to be able to assign a keyboard shortcut to this script, which would then open all their InDesign library files with one simple keyboard command.

       

      --Determine what version of InDesign running as string

      tell application id "com.adobe.InDesign"

          activate

          set myVersion to version of application id "com.adobe.InDesign" as string

          --display dialog myVersion

          if myVersion starts with "6." then

              set myVersion to "version 6.0"

          else if myVersion starts with "7.0" then

              set myVersion to "Version 7.0"

          else if myVersion starts with "7.5" then

              set myVersion to "Version 7.5"

          else if myVersion starts with "8." then

              set myVersion to "Version 8.0"

          else if myVersion starts with "9." then

              set myVersion to "Version 9.0"

          else if myVersion starts with "10.0" then

              set myVersion to "version 10.0"

          else if myVersion starts with "11.0" then

              set myVersion to "version 11.0"

          end if

      end tell

      tell application "Finder"

          try

              set this_folder to folder ((path to current user folder as Unicode text) & "Library:Preferences:Adobe InDesign:" & myVersion & ":en_US:Valpak_Libraries:")

             

             

          on error

              tell application "SystemUIServer"

                  activate

                  display dialog "Could not find the VPLibraries folder. Or maybe it is in the wrong location?" & return & return & "Make sure all of your library {.indl files} reside in:" & return & return & "Admin>Library>Preferences>Adobe InDesign>" & myVersion & ">en_US>Valpak_Libraries" buttons {"Cancel"} default button "Cancel" with icon stop

              end tell

          end try

      end tell

       

      set theList to {".indl"}

      tell application id "com.adobe.InDesign"

          activate

          repeat with i in this_folder

              try

                  set theName to name of i

                  if theName contains theList then

                      open i

                  end if

              end try

          end repeat

      end tell