|
|
GUIDE
TO BOX
--This
script will create a new guide on one side or multiple sides of
a selected InDesign object, or a selected group of InDesign
objects
--Command click "top" "left" "bottom"
"right" in the dialog box to draw multiple guides at
once.
tell
application
"InDesign 2.0.2"
if
(count
of
documents)
< 1 then
return
display dialog
"There are no documents open."
end
if
set
theSel
to
selection
if
theSel
= {} then
return
display dialog
"At least one object must be selected."
if
(count
of
theSel)
= 1 then
if
class
of
item
1 of
theSel
is
in
{insertion point,
character}
then
set
item
1 of
theSel
to
parent text frame
of
item
1 of
theSel
else
if
class
of
item
1 of
theSel
= image
then
set
item
1 of
theSel
to
parent
of
item
1 of
theSel
end
if
end
if
set
theEdges
to
¬
(choose
from list {"top", "bottom",
"left", "right"} ¬
with
prompt "Put a guide
at which edge?" default
items {"left"} ¬
with
multiple selections
allowed without
empty selection allowed)
if
class
of
theEdges
= boolean
then
return
theEdges
--user clicked cancel
repeat
with
theEdge
in
theEdges
if
{"top", "bottom"} contains
(theEdge
as
text)
then
set
theOrientation
to
horizontal
else
set
theOrientation
to
vertical
end
if
set
GBSide
to
(((offset
of
(theEdge
as
text)
in
"00000top000left00bottomright") / 6) as
integer)
if
GBSide
= 0 then
return
theEdge
if
class
of
item
1 of
theSel
is
in
{text frame,
rectangle,
polygon,
oval,
graphic line}
then
set
theLoc
to
item
GBSide
of
geometric bounds
of
item
1 of
theSel
if
(count
of
theSel)
> 1 then
repeat
with
theItem
in
theSel
if
class
of
theItem
is
in
{text frame,
rectangle,
polygon,
oval,
graphic line}
then
if
{"top", "left"} contains
(theEdge
as
text)
then
if
theLoc
> item
GBSide
of
geometric bounds
of
theItem
then
¬
set
theLoc
to
item
GBSide
of
geometric bounds
of
theItem
else
if
theLoc
< item
GBSide
of
geometric bounds
of
theItem
then
¬
set
theLoc
to
item
GBSide
of
geometric bounds
of
theItem
end
if
end
if
end
repeat
end
if
end
if
make
new
guide
at
(parent
of
item
1 of
theSel)
¬
with
properties {orientation:theOrientation,
location:theLoc,
guide color:cyan}
end
repeat
end
tell
--Copyright©2003-2005
Flux Consulting
--May not be republished with out permission.
--Need a custom automation developed for your business?
--Send inquires to
info@fluxconsulting.com or call 212-414-1662.
--Please report bugs to bugs
info@fluxconsulting.com
|