🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2584

Re: Getting a CS2 Script to Work in CS4 VB

#2584
From: Olav_Kvern
Date: Thu, 11 Dec 2008 16:40
39 lines
2162 bytes
Hi Ariel,

Try something like this:



Rem BoxParagraphs.vbs 
Rem An InDesign CS4 VBScript 
Rem 
Rem Converts all paragraphs of a given paragraph style 
Rem to single-cell tables. 
Set myInDesign = CreateObject("InDesign.Application.CS4") 
Set myDocument = myInDesign.Documents.Item(1) 
Set myStyle = myDocument.ParagraphStyles.Item("HRBox") 
myInDesign.FindTextPreferences = idNothingEnum.idNothing 
myInDesign.ChangeTextPreferences = idNothingEnum.idNothing 
myInDesign.FindTextPreferences.AppliedParagraphStyle = myStyle 
Set myFoundItems = myDocument.FindText() 
myInDesign.FindTextPreferences = idNothingEnum.idNothing 
If myFoundItems.Count <> 0 Then 
    For myCounter = myFoundItems.Count To 1 Step -1 
        Set myFoundItem = myFoundItems.Item(myCounter) 
        Set myStartCharacter = myFoundItem.Characters.Item(1) 
        Rem Special case for the last paragraph in a story. 
        Set myEndCharacter = myFoundItem.Characters.Item(-1) 
        If myEndCharacter.Contents = vbCr Then 
            Set myEndCharacter = myFoundItem.Characters.Item(-2) 
        End If 
        Rem Get the text of the paragraph, excluding the return character. 
        Set myText = myFoundItem.Texts.ItemByRange(myStartCharacter, myEndCharacter) 
        Rem Convert the paragraph to a table. 
        Set myTable = myText.Item(1).ConvertToTable 
        Rem Adjust table properties here, if necessary. 
    Next 
End If

Thanks,

Ole
Technical Details
Message-ID: <59b73dfa.0@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!news.glorb.com!feeder.erje.net!news2.arglkargh.de!news01.khis.de!news4us.nl!webcrossing
References: <EE8C7409BFEFD350FB23F81B4B2EA321@in.webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,65c61e7f61fe3d7f
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Olav_Kvern@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: Getting a CS2 Script to Work in CS4 VB
Message-ID: <59b73dfa.0@webcrossing.la2eafNXanI>
Date: Thu, 11 Dec 2008 08:40:19 -0800
References: <EE8C7409BFEFD350FB23F81B4B2EA321@in.webcrossing.la2eafNXanI>
Lines: 38
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!news.glorb.com!feeder.erje.net!news2.arglkargh.de!news01.khis.de!news4us.nl!webcrossing