Article View: adobe.scripting.indesign
Article #15055[VB] Converting GuideBot AppleScript
From: Brian_C._Carter
Date: Tue, 06 Jan 2004 15:18
Date: Tue, 06 Jan 2004 15:18
33 lines
2550 bytes
2550 bytes
I recently picked up Bringhursts The Elements of Typographic Style and Elam's Geometry of Design and have been trying to do work with golden sections and other sort of ratios, etc. Of course I was looking into scripting this and I found Paul Yoon's thread here. Sandee Cohen "automate guide creation?" 3/31/03 8:17am </cgi-bin/webx?14@@.1de887fb/0> and his finished version of the script can be found at <http://projects.darkcutter.com/guidebot/>
It looks exactly like what I want to do...so converting it would be easy right? Well, it should be, but I don't know AppleScript. Or trigonometry, really. I'll probably give it a shot very soon, but it seems so overwhelming to try and interpret two things at once that I thought I'd cast the net, see if anybody else more familiar with the two languages could offer any advice.
And because I've been asking so much lately, here's a really simple VBscript I wrote to turn a rectangle into one with golden proportions. Nothing that couldn't be done in 5 minutes, but hey, if it's already done...
Dim myInDesign
Set myInDesign = CreateObject("InDesign.Application.3.0")
Set myDocument = myInDesign.ActiveDocument
Set myPage = myDocument.Pages.Item(1)
If myInDesign.Selection.Count > 0 Then
Set myObject = myInDesign.Selection(1)
myBounds = myObject.GeometricBounds
myX1 = myBounds(1)
myY1 = myBounds(0)
myX2 = myBounds(3)
myY2 = myBounds(2)
myObjectHeight = myY2-myY1
myObjectWidth = myX2-myX1
if myObjectHeight < myObjectWidth Then
ChangeHorizontal = True
mySmallerDimension = myObjectHeight
Else
ChangeHorizontal = False
mySmallerDimension = myObjectWidth
End If
myLargerDimension = mySmallerDimension * 1.618
if ChangeHorizontal = True then myObject.GeometricBounds = Array(myY1, myX1, myY2, myX1+myLargerDimension)
if ChangeHorizontal = False then myObject.GeometricBounds = Array(myY1, myX1, myY1+myLargerDimension, myX2)
End If
Technical Details
Message-ID:
<2ccf3722.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,526c76df8d4563a4,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-06 07:37:50 PST From: Brian_C._Carter@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [VB] Converting GuideBot AppleScript Message-ID: <2ccf3722.-1@webx.la2eafNXanI> Date: Tue, 6 Jan 2004 07:18:59 -0800 Lines: 48 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit