Article View: adobe.scripting.indesign
Article #1756VBScript Duplicating Formatted Text From Tagged Text File
From: Archie_Tucker
Date: Fri, 23 Jan 2009 17:08
Date: Fri, 23 Jan 2009 17:08
81 lines
3275 bytes
3275 bytes
Working on a VBscript to duplicate formatted text. Below is an example of what I have so far. The problem I have is on the next to last line, how to put the formatted text from the text frame with the placed tagged text file into the new text frame.
Thanks,
Archie
Rem CREATE TEXT FRAMES FUNCTION
Rem ---------------------------
Function myCreateFrames (myDocument)
Set myCurrentFrame = myDocument.TextFrames.Item("myOverFlowFrame")
myCharacterCount = MyCurrentFrame.Characters.Count
Rem Get Product Code
If myCharacterCount > 0 Then
If left(myCurrentFrame.Texts.Item(1).Contents,9) = "[product=" Then
myProductLabel = Mid(myCurrentFrame.Texts.Item(1).Contents,10)
myProductLabel = Split(myProductLabel,"]")(0)' get all to "]"
Set myLastCharacter = myCurrentFrame.Characters.Item(9 + Len(myProductLabel) + 2)
myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents=""
End If
End If
Rem Get Product Width
myCharacterCount = MyCurrentFrame.Characters.Count
If myCharacterCount > 0 Then
If left(myCurrentFrame.Texts.Item(1).Contents,6) = "[wdth=" Then
myProductWdth = Mid(myCurrentFrame.Texts.Item(1).Contents,7)
myProductWdth = Split(myProductWdth,"]")(0)' get all to "]"
Set myLastCharacter = myCurrentFrame.Characters.Item(6 + Len(myProductWdth) + 2)
myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents=""
End If
End If
Rem Get Product Height
myCharacterCount = MyCurrentFrame.Characters.Count
If myCharacterCount > 0 Then
If left(myCurrentFrame.Texts.Item(1).Contents,6) = "[hght=" Then
myProductHght = Mid(myCurrentFrame.Texts.Item(1).Contents,7)
myProductHght = Split(myProductHght,"]")(0)' get all to "]"
Set myLastCharacter = myCurrentFrame.Characters.Item(6 + Len(myProductHght) + 2)
myCurrentFrame.Texts.ItemByRange (1,myLastCharacter).Item(1).Contents=""
End If
End If
Rem Create Product Label frame
Set myTextFrame = myDocument.Textframes.Add
X1=5
Y1=5
myTextFrame.GeometricBounds = Array(Y1, X1, 3 + Y1, myProductWdth + X1)
myTextFrame.Contents = myProductLabel
Set myText = myTextFrame.Texts.Item(1)
With myText
.AutoLeading = 100
.BaselineShift = -3
.FillColor = myDocument.Colors.Item("Red")
End With
Rem Create Product Frame
Set myCurrentFrame = myDocument.TextFrames.Item("myOverFlowFrame")
Set myCurrentText = myCurrentFrame.Texts.Item(1)
Set myTextFrame = myDocument.TextFrames.Add
X1=5
Y1=11
myTextFrame.GeometricBounds = Array(Y1, X1, myProductHght + Y1, myProductWdth + X1)
myTextFrame.Label = "1"
REM Problem Line Below
* ***** myTextFrame.Texts = myCurrentText *******
End Function
Technical Details
Message-ID:
<59b7a6e9.-1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossingShow Full Headers
Complete Article Headers
X-Google-Thread: f939a,a3a3cc76c1812301,start X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Archie_Tucker@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: VBScript Duplicating Formatted Text From Tagged Text File Message-ID: <59b7a6e9.-1@webcrossing.la2eafNXanI> Date: Fri, 23 Jan 2009 09:08:32 -0800 Lines: 92 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit