🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #16371

Re: [VP] Searching for words that are in CAPS in all pages of a doc.

#16371
From: Guy Verville
Date: Fri, 19 Sep 2003 05:18
56 lines
2053 bytes
The actual script here does work, but seems a little bit slow...

* ************************

Dim WordsCount, PagesCount, ParagraphsCount, CharactersCounti, j, k, number, letter

Set myindesign = CreateObject("InDesign.Application.2.0")

Set MyPages = myindesign.ActiveDocument.Pages

PagesCount = MyPages.count

Set MyActualTextFrame = MyPages.Item(1).TextFrames.Item(1)

Set MyStory = MyActualTextFrame.ParentStory

Set MyParagraphs = MyStory.Paragraphs

ParagraphsCount = MyParagraphs.Count

'Paragraph Loop

For l=1 to ParagraphsCount

	'Get WordsCount

	Set MyWords = MyParagraphs.Item(l).TextWords

	WordsCount= MyWords.Count

	'Words Loop

	For j = 1 to WordsCount
		'This is the word
		letter = MyWords.item(j).TextContents
		'Get the Word Lenght
		CharactersCount=Len(letter)
		'If word is long enough
		If CharactersCount > 2 Then
		'To avoid testing capitalized letter and apostrophe, begins with the third letter of the world
			number=Asc(Mid(letter,3,1))

			If number > 64 and number <91 or number >191 and number <222 Then
				Set TheWord = MyWords.Item(j).Characters
				For k=2 to CharactersCount
					TheWord.Item(k).CharacterStyle="BiblioCaps"
				Next
			End If

		End If

	Next

Next

MsgBox "Finish"
Technical Details
Message-ID: <2ccd79e1.1@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccd79e1.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,75fd2c48ad6aecbf
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-09-18 22:37:55 PST
From: "Guy Verville" <taddeus@spamcop.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [VP] Searching for words that are in CAPS in all pages of a doc.
Message-ID: <2ccd79e1.1@webx.la2eafNXanI>
Date: Thu, 18 Sep 2003 22:18:46 -0700
References: <2ccd79e1.-1@webx.la2eafNXanI>
Lines: 58
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit