🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #18735

Re: Newbie contemplating something far too complex?

#18735
From: Dave Saunders
Date: Thu, 27 Feb 2003 20:14
21 lines
1965 bytes
I'd tackle the job this way:

1. Create a list of numbers in an AppleScript variable that is the same length as the number of paragraphs, where each member of the list consists of its own number, i.e., {1,2,3,...}

2. Copy the text of the story into an AppleScript list with each paragraph being an item in the list. (The two lists should be the same length.)

3. Run through the second list deleting any words you want to ignore from the front of the items.

4. Sort the second list alphabetically, while simultaneously applying the same sort to the other list.

[As I type this, it occurs to me that you might do better to set up one list of lists:

{{1,"<paragraph 1"},{2,"<paragraph 2"},{3,"<paragraph 3"},...}

Then you could just sort this list on the second item after stripping out the a's and the's.]

5. Use the numbers in the sorted list to build a new story in your document, picking up paragraph n and adding it to the end of the new story for each time around the loop.

6. Then move the text of the new story over the original story.

Dave
Technical Details
Message-ID: <1de80f24.1@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!news-FFM2.ecrc.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de80f24.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,45607331d5b88ff9
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-02-27 12:37:59 PST
From: "Dave Saunders" <daves@pdsassoc.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!news-FFM2.ecrc.net!newsfeed.icl.net!newsfeed.fjserv.net!lnewspeer00.lnd.ops.eu.uu.net!emea.uu.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Newbie contemplating something far too complex?
Message-ID: <1de80f24.1@WebX.la2eafNXanI>
Date: Thu, 27 Feb 2003 12:14:43 -0800
References: <1de80f24.-1@WebX.la2eafNXanI>
Lines: 31
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit