2 Replies Latest reply on Apr 16, 2013 5:19 AM by Janaaaaa

    Export panel automatic export button click applescript

    Janaaaaa

      HI.

       

      Is there any way to click Indesign export button in  export pdf panel with applescript

       

      I am doing applescrict to export pdf:s and I can not use in code printing option ( without showing options) cause

      sometimes some elements wont print  to final pdf. and that is problem also all commercial programs when background printing is enabled.

       

      So I try build script with showing options but I can not automatically click that export button.

       

      I tried this one but it does nothing.

       

                tell application "System Events" to tell process "Adobe InDesign CS5.5"

        key code 36

                          end tell

       

       

       

      This is my hole script so far under construction

       

      tell application "Finder"

                if not (exists folder "myFolder") then

        make new folder at desktop with properties {name:"myFolder"}

                end if

      end tell

       

       

       

      tell application "Finder"

                set myfiles to the selection

      end tell

       

      tell application "Adobe InDesign CS5.5"

        activate

                repeat with i in myfiles

                          open (i as alias)

       

                          set thePreset to "[Smallest File Size]"

       

                          set theDesk to (path to desktop as string) & "myFolder:"

                          set f to (name of i as string)

                          set thepath to theDesk & f

        delay 2

        export document 1 to file (thepath & ".pdf") format PDF type using PDF export preset thePreset with showing options

                          tell application "System Events" to tell process "Adobe InDesign CS5.5"

        key code 36

                          end tell

       

       

       

        close active document saving no

       

                end repeat

      end tell

       

       

       

       

      Thanks if someone have Idea

        • 1. Re: Export panel automatic export button click applescript
          Muppet Mark Level 5

          Well personally I think you should look to resolving your issues in other ways… I don't really see where calling up the GUI dialog fixes things… Anyhows that aside this does force a keystoke when required…

           

          tell application "Finder"

                    if not (exists folder "myFolder") then

            make new folder at desktop with properties {name:"myFolder"}

                    end if

                    set myfiles to the selection

          end tell

          --

          tell application "Adobe InDesign CS5"

            activate

                    repeat with i in myfiles

                              open (i as alias)

                              set thePreset to "[Smallest File Size]"

                              set theDesk to (path to desktop as string) & "myFolder:"

                              set f to (name of i as string)

                              set thepath to theDesk & f

                              with timeout of 5 seconds

                                        try

            export document 1 to file (thepath & ".pdf") format PDF type ¬

            using PDF export preset thePreset with showing options

                                        on error

                                                  my keyStroker()

                                        end try

                              end timeout

            close active document saving no

                    end repeat

          end tell

          --

          on keyStroker()

                    tell application "System Events" to tell process "Adobe InDesign CS5" to keystroke return

          end keyStroker

          • 2. Re: Export panel automatic export button click applescript
            Janaaaaa Level 1

            Thank you very much Muppet Mark. You are great.

            Now I can go home and leave exporting running on evening.

             

            Yes this might be not greatest way exporting but I can be sure that every elemenet is showing in final pdf.

            and only way I can figure this out is this way.

            I have to develop this little more to print individual pages from indesign and ignoring overset text and something else.

             

            I think that we have so many different graphics and raster images with different file types that something goes sometimes wrong

            when exporting to pdf version 1.3 and  rasterizing and flattening is going on.

             

            Callig GUI seems to do the job. at least 50 pdf exported right.

             

            Thanks.