10 Replies Latest reply on Mar 26, 2009 2:05 PM by sstanleyau

    Script to use to close pdf file

    Barb Wentzell Level 1
      Could someone tell me the wording to use in a script that will close a pdf file?

      The script I'm using will open an InDesign CS2 file (when dragged into a folder that has the action script applied to it), generate a pdf and then close the InDesign file. I don't know how to tell the script to close the pdf file.

      I don't need to see the pdf file at all, so maybe there's a way to generate the pdf without it ever opening???

      Thanks for any help.
        • 1. Re: Script to use to close pdf file
          Level 1
          Which scripting language are you using? What statement are you using to generate the PDF?

          Dave
          • 2. Re: Script to use to close pdf file
            Barb Wentzell Level 1
            Scripting is totally Greek to me so I don't know what scripting language I'm using.
            If it helps, I'm working on a Mac, system OS X (10.4.11) and I'm using Script Editor to make the script, InDesign CS2 (soon to go to CS4) and Acrobat 7.0 Professional.

            About a year ago I found a script somewhere online that I was able to modify by trial and error to suit our purposes. We needed to check the pdf files that were generated, before we closed them, so that worked fine. Now I'm using the same script to generate more pdfs that we don't need to view. Everyone would like it better if they didn't have to be always closing pdf files.

            As to what statement I'm using to generate the pdf, is this what you mean:
            "export this_image format PDF type to target_path using "150lpi" without showing options"

            Barb
            • 3. Re: Script to use to close pdf file
              Level 1
              You're using AppleScript. Could it be that your 150lpi preset has View PDF after exporting activated?

              Dave
              • 4. Re: Script to use to close pdf file
                Level 1
                Open Indesign, export a pdf manually and check off "View PDF after Exporting" dn use your script

                Shonky
                • 5. Re: Script to use to close pdf file
                  Barb Wentzell Level 1
                  Thanks for the replies.

                  The only problem is that we make pdfs for different purposes. Most have different requirements so we've defined different presets, and we export from InDesign with Viewing turned on. If you turn on View PDF after Exporting once, it stays on until you turn it off again. You can't choose that option when you define a PDF Preset.

                  We may have to make a pdf that we need to view and the next one we don't need to view and so on. (Unfortunately because of the work flow we can't make all one kind of pdf and then all another kind). If we turn viewing on for one pdf, then it stays on for the next one.
                  A script for the ones we don't need to view would speed things up quite a bit. We would just drag the file to a folder that has an action script applied to it and let it do its thing.

                  Isn't there a way to add a line to my script to close the pdf file?????

                  Barb
                  • 6. Re: Script to use to close pdf file
                    Level 1
                    In AppleScript you can probably tell Acrobat to close the document, but it's been a long time for me...

                    Dave
                    • 7. Re: Script to use to close pdf file
                      Barb Wentzell Level 1
                      This is the last part of my script:

                      tell application "Adobe InDesign CS2"
                      launch
                      set this_image to open file (source_file as string)
                      export this_image format PDF type to target_path using "150lpi" without showing options
                      close this_image saving no
                      tell application "Adobe Acrobat 7.0 Professional"
                      activate

                      I've tried different words and phrases to get the pdf to close, but as I don't know the lingo nothing is working for me.

                      Barb
                      • 8. Re: Script to use to close pdf file
                        Dirk Becker  Level 4
                        No Acrobat Pro on this Mac. With my Acrobat Reader the following scripts translate but fail to execute. This might be just a Acrobat Reader problem, so try them anyway:

                        tell application "Adobe Acrobat 7.0 Professional" to close document 1
                        tell application "Adobe Acrobat 7.0 Professional" to close all docs

                        Stronger measures - should always work:
                        tell application "Adobe Acrobat 7.0 Professional" to quit
                        tell application "Adobe Acrobat 7.0 Professional" to quit saving no

                        Dirk
                        • 9. Re: Script to use to close pdf file
                          Barb Wentzell Level 1
                          Dirk

                          Telling Acrobat to 'close document 1' or 'close all docs' both work great.

                          Thanks for your help.

                          Barb
                          • 10. Re: Script to use to close pdf file
                            sstanleyau Level 4
                            On 27/3/09 3:21 AM, "Barbara Wentzel" <member@adobeforums.com> wrote:<br /><br />> Telling Acrobat to 'close document 1' or 'close all docs' both work great.<br /><br />Just be aware that Acrobat regards the first document opened as document 1,<br />not the frontmost. So either use close all docs, or specify the troublesome<br />doc by name.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>