Article View: adobe.scripting.indesign
Article #8907Re: How to begin scripting?
From: Zoar
Date: Fri, 22 Sep 2006 17:50
Date: Fri, 22 Sep 2006 17:50
52 lines
2886 bytes
2886 bytes
Hello,
I've played with Applescript, and now I'm looking at scripting InDesign. I'm going through the tutorial scripts provided, and right away I'm getting an error. This comes directly from the InDesign Scripting Guide. I have a document with a text frame open. Below is the script from the guide:
--Improved "Hello World"
tell application "Adobe InDesign CS2"
--Get a reference to a font.
try
--Enter the name of a font on your system, if necessary.
set myFont to font "Helvetica"
end try
--Get the active document and assign the result to the variable "myDocument".
set myDocument to active document
tell myDocument
--Use the handler "myGetBounds" to get the bounds of the live area inside the margins of page 1.
set myBounds to my myGetBounds(myDocument, page 1)
tell text frame 1 of page 1
--Resize the text frame to match the page margins.
set geometric bounds to myBounds
tell paragraph 1
--Change the font, size, and paragraph alignment.
try
set applied font to myFont
end try
set point size to 72
set justification to center align
end tell
end tell
end tell
end tell
--myGetBounds is a handler that returns the bounds of the live area of a page.
on myGetBounds(myDocument, myPage)
tell application "Adobe InDesign CS2"
set myPageHeight to page height of document preferences of myDocument
set myPageWidth to page width of document preferences of myDocument
set myLeft to left of margin preferences of myPage
set myTop to top of margin preferences of myPage-------DOESN'T LIKE THIS LINE
set myRight to right of margin preferences of myPage
set myBottom to bottom of margin preferences of myPage
end tell
set myRight to myLeft + (myPageWidth - (myRight + myLeft))
set myBottom to myTop + (myPageHeight - (myBottom + myTop))
return {myTop, myLeft, myBottom, myRight}
end myGetBounds
I get an error on compile at the designated line. It throws a syntax error: Expected end of line, etc. but found application constant or consideration. I don't get it. It's fine with the other set commands.
Any ideas? If you can't get the tutorial scripts to run, how can you learn anything. I hope it's something simple like a typo that I'm not catching.
Regards,
Zoar
Technical Details
Message-ID:
<3bbd759f.125@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news2.volia.net!news.germany.com!news.isoc.lu!webcrossingReferences:
<3bbd759f.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,dd9eb181c1e6fc23 X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Zoar@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!news2.volia.net!news.germany.com!news.isoc.lu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: How to begin scripting? Message-ID: <3bbd759f.125@webcrossing.la2eafNXanI> Date: Fri, 22 Sep 2006 10:50:29 -0700 References: <3bbd759f.-1@webcrossing.la2eafNXanI> Lines: 64 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit