14 Replies Latest reply on Feb 20, 2012 11:33 AM by Muppet Mark

    Applescript - export book to interactive pdf

    Evilia_77 Level 1

      Hi guys,

       

      i want to make a script to export a book to interactive pdf.

       

      This is what I get, but i doesn't seem to work. What do I do wrong?

       

      tell application "Adobe InDesign CS5.5"

                                    tell active book

                                              tell mybook

        export format interactive PDF to myFile

                                                        set export layers of interactive PDF export preference to true

                                                        set generate thumbnails of interactive PDF export preference to true

                                                        set pdf magnification of interactive PDF export preference to fit page

                                                        set pdf page layout of interactive PDF export preference to single page

                                              end tell

                                    end tell

       

       

       

      thanks

        • 1. Re: Applescript - export book to interactive pdf
          [Jongware] Most Valuable Participant

          Why "doesn't it seem to work"?

           

          (thinking) ... if you think it "doesn't work" because (a) you get a PDF, (b) it's interactive (whatever that means), but (c) none of the settings you specify are applied, then it's quite simple. The first line after "tell mybook" exports your PDF. When it's done, the rest set the preferences for a next export. This is equal to, well, something like first printing an entire document and when it's done say "Oh I only wanted pages 1 to 10. If I change that in the Print dialog now it might still work".

           

          Try with setting the preferences first and only then export.

          • 2. Re: Applescript - export book to interactive pdf
            Evilia_77 Level 1

            yes your wright.. I tried severall thins, like changing the order of the script, and , unfortunally, this is a bad copy.

             

            Even if I put the line "export format interactive pdf to myFile" after the preferences, I doesn't work..

            • 3. Re: Applescript - export book to interactive pdf
              Muppet Mark Level 5

              The green items of your code are variables neither of which you declare/set in your sample… myFile, mybook… what file, what book… You also reference one book inside another I don't use books so Im unsure is this valid? It's like asking for document 1 of the active document in terms of objects and containers can this exist?

              • 4. Re: Applescript - export book to interactive pdf
                Evilia_77 Level 1

                Mark,

                 

                I am sorry I just get started with applescript, I know I make a lot of stupid errors (shame shame shame), but I really want to learn it.. so..

                 

                I tried this aswell:

                 

                tell application "Adobe InDesign CS5.5"

                          tell active book

                                    set myDesktopFolder to path to desktop as string

                                    set myFile to myDesktopFolder & "InteractivePDF.pdf" as string

                                    set properties of interactive PDF export preferences to {export layers:true, generate thumbnails:true, pdf magnification:fit page, pdf page layout:single page}

                  export format interactive PDF to myFile

                          end tell 

                end tell

                 

                When I delete the sentence of properties, the export works fine. So at this moment only the sentence of the proporties has to be changed...

                • 5. Re: Applescript - export book to interactive pdf
                  Muppet Mark Level 5

                  Im just having a quick look at the documentation as its an app feature I've yet to utilize… Looks like you need a couple of additional parameters eg. book content and so on… All new to me I will go see if I can make a book…

                  • 6. Re: Applescript - export book to interactive pdf
                    Muppet Mark Level 5

                    By the looks of things its just an issue of being out of order… Jong correctly pointed out the prefs before the export but the do infact belong to the app and not a book so they should be moved like so…

                     

                    set iaPDF to (path to desktop as text) & "Testing.pdf"

                    --

                    tell application "Adobe InDesign CS5"

                      activate

                              tell interactive PDF export preferences

                                        set export layers to true

                                        set generate thumbnails to true

                                        set pdf magnification to fit page

                                        set pdf page layout to single page

                              end tell

                              tell active book

                      export format interactive PDF to iaPDF

                              end tell

                    end tell

                     

                    First time book user and I got a PDF interactive? who knows…

                    • 7. Re: Applescript - export book to interactive pdf
                      Evilia_77 Level 1

                      wow Mark, you did it!! You are my hero..

                       

                      Thanks a lot..

                       

                      Maybe you will see (read) me soon.. ;-)

                      • 8. Re: Applescript - export book to interactive pdf
                        Muppet Mark Level 5

                        No problem… My mind is becoming some what fuzzy around the edges with AppleScript… Muppets inherit fuzzy from parent… can't help it…

                        • 9. Re: Applescript - export book to interactive pdf
                          Evilia_77 Level 1

                          Mark,

                           

                          I am sorry, but here I am again...

                           

                          at the end of my script I want to create a book with the documents of the workingfolder.

                          this is wat I have (fileAlias and targetFolder are identified earlier in the script)

                           

                          tell application "Adobe InDesign CS5.5"

                                              set fileAlias to targetFolder as alias

                                              set theBook to active book

                            make book content at theBook with properties {full name:fileAlias}

                                    end tell

                           

                          I get an error on make book content at... I think he wants to put the "folder" in the book, instead of the document in the folder.

                           

                          thanks

                          • 10. Re: Applescript - export book to interactive pdf
                            Muppet Mark Level 5

                            It looks like you should loop through adding content to a book… This worked for me it does NO checking of the selected folder for its file content type in my test case just ID docs…

                             

                            set idBook to (path to desktop as text) & "Testing.indb"

                            --

                            tell application "Finder"

                                      set idFiles to (files of (choose folder)) as alias list

                            end tell

                            --

                            tell application "Adobe InDesign CS5"

                              activate

                                      set mybook to make new book ¬

                              with properties {full name:idBook}

                                      tell mybook

                                                repeat with i from 1 to count of idFiles

                              make new book content ¬

                              with properties {full name:item i of idFiles}

                                                end repeat

                              save

                                      end tell

                            end tell

                            • 11. Re: Applescript - export book to interactive pdf
                              Evilia_77 Level 1

                              Mark, thanks. I tried the script at my work.

                               

                              I could make a book, only the order of the documents was revert. I have to work on that. If you have an idea how to revert the order.. ;-)

                              • 12. Re: Applescript - export book to interactive pdf
                                Muppet Mark Level 5

                                repeat with i from count of idFiles to 1 by -1

                                --will reverse the loop…

                                • 13. Re: Applescript - export book to interactive pdf
                                  Evilia_77 Level 1

                                  Thanks again..

                                   

                                  Can you recomand me a tutorial or a good book.. It will help me a lot...

                                  • 14. Re: Applescript - export book to interactive pdf
                                    Muppet Mark Level 5

                                    I don't do books only free stuff pdf manuals and such you should get yourself the Apple Guide… from:

                                     

                                    http://manuals.info.apple.com/en_US/AppleScriptLanguageGuide.pdf

                                     

                                    Shirley Hopkins books are always recommended…