Re: InDesign Scripting
Re: InDesign Scripting
- Subject: Re: InDesign Scripting
- From: email@hidden
- Date: Thu, 11 Apr 2002 11:24:53 -0600
I think you have run into some of the subtleties of working with InDesign
as opposed to working with Quark.
Notice that in the version where you are telling the document to create the
rectangle, that you are making the rectangle "at end".
At end of what? At the end of the document? at the end of the first page? I
think this is where InDesign decided to "pull the plug" on your script. The
document can create and manage items on the first page, but don't use "at
end" (or "at beginning" for that matter). The page and spread allow the
"at" reference because they assume that you are creating the object at the
end of their page items list. Again, I would avoid using the "at" reference
unless you really have a reason for doing so.
There should be no difference between telling spread 1 as opposed to
telling page 1 unless you have a facing page spread and need to tell page 1
of spread 2, etc. I think what you are seeing is the fact that InDesign
will use the currently accessed fill color to fill an object if you fail to
give it a proper reference to the color you want to use. The reason for the
difference between the "tell spread" and the "tell page" scripts? Maybe you
just happened to have the desired fill color chosen when you executed the
tell spread script.
Color (swatches) are objects of the document. If you want to refer to a
swatch within a tell statement to a page or spread, you need to give a full
reference to the swatch. Normally, this is done by placing a reference to
the active document in a variable and then using this reference:
tell application "InDesign 2.0"
set theDoc to active document
tell page 1 of theDoc
set theRect to (make rectangle at end with properties {visible bounds: {"10
pt", "10 pt", "60 pt", "60 pt"}, fill color: swatch "Box Color" of theDoc})
etc.
You will often see scripts for InDesign place a reference to a color swatch
into a variable and then use the variable to apply the color. Try the
following:
tell application "InDesign 2.0"
tell document 1
try
set myBoxColor to swatch "Box Color"
on error--will error if color swatch not found
return beep
end try
tell page 1
set theRect to (make rectangle at end with properties {visible
bounds: {"10 pt", "10 pt", "60 pt", "60 pt"}, fill color: myBoxColor})
end tell--page
end tell--document
end tell--application
Hope this helps
Shirley Hopkins
FaceSpan Support
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.