Думаю такой скрипт заитересует всех тех у кого верстка не модульная.
Private Sub Command1_Click()
Dim myText As InDesign.TextFrame
Dim myDocument As InDesign.Document
Set myInDesign = CreateObject("InDesign.Application.CS")
Set mySelection = myInDesign.Selection.Item(1)
Set myText = myDocument.TextFrames.Add
myXYS = myCalculate(mySelection)
MsgBox ("x: " & myXYS(0) & "cm" & vbCr & "y: " & myXYS(1) & "cm" & vbCr & "Aria: " & myXYS(2))
myText.GeometricBounds = Array(myXYS(3), myXYS(4), myXYS(5), myXYS(6))
myText.Contents = myXYS(2)
End Sub
Private Function myCalculate(myObject)
myBounds = myObject.VisibleBounds
myXl = myBounds(1)
myYl = myBounds(0)
myX2 = myBounds(3)
myY2 = myBounds(2)
myX = CSng((myX2 - myXl) / 10)
myY = CSng((myY2 - myYl) / 10)
TmyX1 = (myX1 - 2)
TmyY1 = (myY1 - 2)
TmyX2 = (myX2 - 2)
TmyY2 = (myY2 - 2)
aria = myX * myY
myCalculate = Array(myX, myY, aria, TmyX1, TmyY1, TmyX2, TmyY2)
End Function
Run-Time error '91':
Object variable or With block not set
Private Sub Command1_Click()
Dim myIndesign As InDesign.Application
Dim myDocument As InDesign.Document
Dim myText As InDesign.TextFrame
Dim myPage As InDesign.Page
Set myIndesign = CreateObject("InDesign.Application.CS")
Set mySelection = myIndesign.Selection.Item(1)
Set myDocument = myIndesign.Documents.FirstItem
Set myPage = myDocument.Pages.Item(1)
Set myText = myPage.TextFrames.Add
myXYS = myCalculate(mySelection)
MsgBox ("x: " & myXYS(0) & "cm" & vbCr & "y: " & myXYS(1) & "cm" & vbCr & "Aria: " & myXYS(2))
myText.GeometricBounds = Array(myXYS(3), myXYS(4), myXYS(5), myXYS(6))
myText.Contents = Str$(myXYS(2))
End Sub
Private Function myCalculate(myObject)
myBounds = myObject.VisibleBounds
myX1 = myBounds(1)
myY1 = myBounds(0)
myX2 = myBounds(3)
myY2 = myBounds(2)
myX = CSng((myX2 - myX1) / 10)
myY = CSng((myY2 - myY1) / 10)
TmyY1 = (myY1 - 5)
TmyY2 = (myY1 - 1)
aria = myX * myY
myCalculate = Array(myX, myY, aria, TmyY1, myX1, TmyY2, myX2)
End Function