3 Replies Latest reply on Jan 28, 2016 5:32 AM by rob day

    Applescript and Indesign files

    ciceroc69199093

      Hi I am using this script :

       

       

      set demodoc to (choose file with prompt "Where is “Scripting Examples:chevalet Indesign?" of type {"indd"})

      tell application "Finder"

        set demofolder to (container of myDocument) as text

      end tell

      tell application "Adobe InDesign CS5"

      activate

      import data from file (demofolder & "Fusion.txt") ¬

        using prototype story "chevalet" into story "page"

      end tell



      But the problem is when I am testing it, the prompt is not able to see Indesign files.

      I tested several times with indt, .indd, InDd, idml, ...  but nothing is working.

      I don't really understand.


      I have actually Adobe InDesign CS6 and Mac OSX Yosemite.


      Can someone help me please?


        • 1. Re: Applescript and Indesign files
          rob day Adobe Community Professional & MVP

          Try

           

          set demodoc to (choose file with prompt "Where is “Scripting Examples:chevalet Indesign?" of type {"InDd", "IDd4", "IDd5", "IDd6", "IDd7", "IDd8", "IDd9", "IDdX", "IDdXI", "IDXt"})

          • 2. Re: Applescript and Indesign files
            ciceroc69199093 Level 1

            Hi,

             

            It's working, and it's better than I expected all files and also folder can be seen by the prompt.

             

            Really thanks Sir Rob.

             

            Regards,

            • 3. Re: Applescript and Indesign files
              rob day Adobe Community Professional & MVP

              Would it be easier to simply ask for the text file and wrap the import command in a try, which you should probably do anyway in case the import fails? Something like:

               

              tell application "Finder"

                   --note for the prompt to display this line has to be in the Finder tell

                  set demodoc to (choose file with prompt "Where is the Fusion Text File?")

                  tell application "Adobe InDesign CS5"

                      try

                          --import commands

                      on error

                          display dialog

                          "Please choose a Text File"

                             return

                      end try

                  end tell

              end tell