Article View: adobe.scripting.indesign
Article #20743Export all stories from all chapters of book? (Applescript)
From: Aaron Andrade
Date: Wed, 05 Jun 2002 00:42
Date: Wed, 05 Jun 2002 00:42
9 lines
2576 bytes
2576 bytes
The script included on the 2.0 CD for exporting text from all stories in a document.... works fine. I'd like to do the same with all documents in a book. Preferably auto-saved in subfolders named according to chapter (document) title, within a master folder of my own choosing. Can anyone help? i'm an Applescript novice and find the ID2 scripting guide merely a withered carrot dangled several feet out from a lofty precipice. Here's the original script, except I've changed file type to RTF (from tagged text) -- apologies for the formatting: --ExportAllStories --An InDesign 2.0 script. --For more on InDesign scripting, go to --http://www.adobe.com/products/indesign/scripting.html --Export all stories in the current document. set myFolder to choose folder with prompt "Select a folder in which to store the exported files" tell application "InDesign 2.0" --Set a file extension for cross-platform compatibility (use ".txt" for text and ".rtf" for RTF). set myExtension to ".rtf" try set myErrorMessage to "No documents are open. Please open a document and try again." set myDocument to document 1 if (count stories of myDocument) = 0 then set myErrorMessage to "Open a document containing some text and try again." error end if repeat with myCounter from 1 to (count stories of myDocument) --Name each story using the story ID. set myFileName to "story " & id of story myCounter of myDocument & myExtension --Create the path to the export file. set myFilePath to (myFolder as string) & myFileName tell story myCounter of myDocument --Export formats are: tagged text, text type, and RTF export format RTF to myFilePath without showing options end tell end repeat --myStoryCounter on error activate display dialog myErrorMessage end try end tell
Technical Details
Message-ID:
<ef8ed19.-1@WebX.aaQKaf7vad4>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed-east.nntpserver.com!nntpserver.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,4d2147f4ec8ee501,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-06-04 18:07:37 PST From: "Aaron Andrade" <aaronandrade@sprintmail.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!newsfeed-east.nntpserver.com!nntpserver.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Export all stories from all chapters of book? (Applescript) Message-ID: <ef8ed19.-1@WebX.aaQKaf7vad4> Date: Tue, 4 Jun 2002 17:42:50 -0700 Lines: 50 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit