🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16890

Re: Applescript (or VB) to format References?

#16890
From: Jay Fraser
Date: Mon, 28 Jul 2003 18:43
46 lines
2883 bytes
This works with the sample provided:



tell application "InDesign 2.0.2" 
   set myDocument to active document 
   tell myDocument

      set myStory to object reference of parent story of selection 
      tell myStory 
         repeat with myCounter from 1 to (count paragraphs) 
            try 
               set myFirstStop to (index of first character of paragraph myCounter whose contents = ".") 
               set mySecondStop to (index of second character of paragraph myCounter whose contents = ".") 
               set myThirdStop to (index of third character of paragraph myCounter whose contents = ".") 
               set myLastComma to (index of last character of paragraph myCounter whose contents = ",") 
               set mySecondLastComma to (index of character -2 of paragraph myCounter whose contents = ",") 
            on error 
               activate 
               display dialog "Some sort of whoopsie occurred paragraph " & myCounter & "." 
               exit repeat 
            end try

            set myFindSpecialSpace to object reference of characters myThirdStop thru mySecondLastComma 
            set mySpecialSpace to (index of last character of myFindSpecialSpace whose contents = " ")

            set myAuthors to object reference of characters (myFirstStop + 2) thru mySecondStop 
            set myJournal to object reference of characters (myThirdStop + 2) thru mySpecialSpace 
            set myVolume to object reference of characters (mySecondLastComma + 2) thru myLastComma

            set properties of myAuthors to {font style:"Bold"} 
            set properties of myJournal to {font style:"Italic"} 
            set properties of myVolume to {font style:"Bold"}

         end repeat 
      end tell 
   end tell 
end tell



The script assumes that a) the story has nothing but references, b) something in that story is selected, and c) there are no blank paras in the story.

So it'll probably break in the real world, but it's a start. If the references have a specifit para style, I can fix a lot of the problems. Let me know if it works for you.

Jay
Technical Details
Message-ID: <1dea17d8.6@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1dea17d8.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,8c572854569a1f90
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-07-28 12:08:06 PST
From: "Jay Fraser" <jayfraser@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: Applescript (or VB) to format References?
Message-ID: <1dea17d8.6@WebX.la2eafNXanI>
Date: Mon, 28 Jul 2003 11:43:31 -0700
References: <1dea17d8.-1@WebX.la2eafNXanI>
Lines: 57
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit