Article View: adobe.scripting.indesign
Article #2582Getting a CS2 Script to Work in CS4 VB
From: Ariel_Walden
Date: Thu, 11 Dec 2008 13:55
Date: Thu, 11 Dec 2008 13:55
41 lines
2445 bytes
2445 bytes
Hi,
The following script works for CS2. I am now trying to run it in CS4 but it
doesn't work. I have put the script in a folder within a folder called
"Version 2.0 Scripts" (inside the preexisting "Scripts Panel" folder).
Nevertheless, it doesn't work. Can anyone help me run this in CS4?
Rem BoxParagraphs.vbs
Rem An InDesign CS2 VBScript
Rem
Rem Converts all paragraphs of a given paragraph style
Rem to single-cell tables.
Set myInDesign = CreateObject("InDesign.Application.CS2")
Set myDocument = myInDesign.Documents.Item(1)
Set myStyle = myDocument.ParagraphStyles.Item("HRBox")
myInDesign.FindPreferences = idNothingEnum.idNothing
myInDesign.ChangePreferences = idNothingEnum.idNothing
myInDesign.FindPreferences.AppliedParagraphStyle = myStyle
Set myFoundItems = myDocument.Search()
myInDesign.FindPreferences = 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
Thank you,
Ariel
Technical Details
Message-ID:
<EE8C7409BFEFD350FB23F81B4B2EA321@in.webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,65c61e7f61fe3d7f,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Ariel_Walden@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Getting a CS2 Script to Work in CS4 VB Message-ID: <EE8C7409BFEFD350FB23F81B4B2EA321@in.webcrossing.la2eafNXanI> Date: Thu, 11 Dec 2008 05:55:44 -0800 Lines: 49 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit