Article View: adobe.scripting.indesign
Article #17889Re: Step and repeat... in VB?
From: Stu Bloom
Date: Sun, 11 May 2003 04:11
Date: Sun, 11 May 2003 04:11
41 lines
2202 bytes
2202 bytes
Thanks for the heads-up. You might want to fix page 460 in the scripting guide:
Rem myPolygon.Move moveBy:=array(0, "12p")
Actually, I should have used moveBy instead of moveTo. Here's the corrected code (note the change in the object reference in the Move line, as well):
Option Explicit
Public Function StepAndRepeat(objDup As Object, nRepeatCount As Long, _
nHorizontalPoints As Single, nVerticalPoints As Single) As Boolean
Dim nRepeats As Long
Dim objDuped As Object
On Error GoTo CantStepAndRepeat
Select Case TypeName(objDup)
Case "EPS", "Group", "Image", "Line", "Oval", "PageItem", _
"PDF", "Polygon", "Rectangle", "TextFrame"
If nRepeatCount > 0 Then
For nRepeats = 1 To nRepeatCount
Set objDuped = objDup.Duplicate
objDuped.Move , Array(nHorizontalPoints * nRepeats & "pt", _
nVerticalPoints * nRepeats & "pt")
Next nRepeats
End If
StepAndRepeat = True
Case Else
' not a duplicatable object, so raise an error
' To use the information passed to the Raise method, remove
' the On Error Goto and trap the error in the caller
Err.Raise vbObjectError + 1000, "StepAndRepeat", _
"Object type cannot be duplicated"
End Select
Exit Function
CantStepAndRepeat:
StepAndRepeat = False
Exit Function
End Function
Technical Details
Message-ID:
<1de9118c.4@WebX.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de9118c.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,b719383c7f1db8f5 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-05-10 21:38:44 PST From: "Stu Bloom" <stu@earlvillepost.com> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Step and repeat... in VB? Message-ID: <1de9118c.4@WebX.la2eafNXanI> Date: Sat, 10 May 2003 21:11:02 -0700 References: <1de9118c.-1@WebX.la2eafNXanI> Lines: 46 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit