5 Replies Latest reply on Mar 17, 2008 5:57 AM by Kasyan Servetsky

    Applescript to export pages with PDF preset

      We publish books containing articles by 10, 20, 30, 40 contributors... I'd like to create a text file for each book giving the page numbers to be exported and the pdf filename to be produced

      1-4,23-37,398-399 edc-Doe-2008-03-06.pdf
      1-4,39-64,398-399 edc-Smith-2008-03-06.pdf

      and run a script to export those files using the Smallest File Size preset to a directory that the script would ask me to specify.

      It would be even better if it went on to tell Apple Mail to create a message for each author (using the email address that I would add to each line) with a message taken from a text file that the script would ask me to specify, same message for all authors, pdf attached.

      Does anyone have any scripts that might get me started in the right direction? I'm pretty hopeless at scripting from scratch, a bit better at modifying existing scripts...

      Thanks !

      AB
        • 1. Re: Applescript to export pages with PDF preset
          Kasyan Servetsky Level 5
          Hi AB,

          I have written a couple of scripts that do something similar; I used them for e-mailing articles from our magazine to TV companies.
          The first script takes all InDesign files from a folder, exports them using the Smallest File Size preset to another folder, naming the files according to the page range of the document (first page last page) e.g. 45-49.pdf, or 55.pdf (for a single page document), Cover.pdf (if page name contains cover). Then the script moves InDesign files to Completed folder.
          The second script sends these pdf files via Mail application to the specified addresses one by one.
          These scripts can be combined into one, of course, but I prefer to check pdf files before sending.
          If you are interested to use them as a starting point, I can post them or e-mail them to you.

          Kasyan
          • 2. Re: Applescript to export pages with PDF preset
            Level 1
            Yes, Kasyan, I (andrew.brown) much appreciate your offer and would be
            very glad to see them (at c18.net). Many thanks ! -- AB

            On 6 Mar 2008, at 15:06, Kasyan Servetsky wrote:

            > I have written a couple of scripts that do something similar; I
            > used them for e-mailing articles from our magazine to TV companies.
            > The first script takes all InDesign files from a folder, exports
            > them using the Smallest File Size preset to another folder, naming
            > the files according to the page range of the document (first page
            > last page) e.g. 45-49.pdf, or 55.pdf (for a single page document),
            > Cover.pdf (if page name contains cover). Then the script moves
            > InDesign files to Completed folder.
            > The second script sends these pdf files via Mail application to the
            > specified addresses one by one.
            > These scripts can be combined into one, of course, but I prefer to
            > check pdf files before sending.
            > If you are interested to use them as a starting point, I can post
            > them or e-mail them to you.
            • 3. Re: Applescript to export pages with PDF preset
              Kasyan,

              It appears that you have figured out how to use the export command. I have experimented with it in AppleScript a couple of times, but have never been able to get it to work. I have tried the sample script for the export command that Adobe published in its PDF documentation for InDesign 2.0, supplying the format exactly as it appears in the pop-up menu for the Export dialog box and a valid file reference for the file to which to export; but all I get are error messages, whether I direct the command to a text frame (to export as tagged text or RTF, for example) or to InDesign or to the spread (to export as PDF), saying that the object does not understand the "export" command. Is there some other little secret about the export command? Maybe you could post a sample line of code of a valid export command -- one that will actually work? Many thanks.
              • 4. Re: Applescript to export pages with PDF preset
                sstanleyau Level 4
                On 16/3/08 4:44 AM, "Vance Hawkins" <member@adobeforums.com> wrote:<br /><br />> I direct the command to a text frame (to export as tagged text or RTF, for<br />> example)<br /><br />You should be targetting the contents, not frames.<br /><br />> or to InDesign or to the spread (to export as PDF),<br /><br />Target the document for PDF.<br /><br />set deskPath to path to desktop as Unicode text<br />tell application "Adobe InDesign CS3"<br />    set screenSettings to PDF export preset "[Smallest File Size]"<br />    set page range of PDF export preferences to all pages<br />    set docName to name of document 1<br />    if docName ends with ".indd" then<br />        set docName to text 1 thru -6 of docName<br />    end if<br />    export document 1 format PDF type to (deskPath & docName & ".pdf") using<br />screenSettings without showing options<br />end tell<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
                • 5. Re: Applescript to export pages with PDF preset
                  Kasyan Servetsky Level 5
                  Hi Vance,

                  First of all, you can download updated example scripts for CS3 from here:
                  http://wwwimages.adobe.com/www.adobe.com/products/indesign/scripting/downloads/indesign_cs 3_guide_scripts.zip
                  In the folder AppleScript\documents you can find 4 scripts that export to PDF.
                  You also can find these scripts and their detailed description in the chapter “Exporting a Document as PDF”, starting on the page 36, of the InDesign CS3 scripting guide:
                  http://wwwimages.adobe.com/www.adobe.com/products/indesign/scripting/pdfs/InDesignCS3_Scri ptingGuide_AS.pdf
                  If you want, I can send you examples that I e-mailed to Andrew, but I’ll be able to do it since Wednesday.

                  Kasyan