I have a CS3 InDesign document with a single page in it, the page has several boxes drawn on it. Can I use Applescript to get the X and Y coordinates of boxes? Do I need to tag each box first and call them box1, box2, etc? If so can someone help me with the script portion, I admit it I’m new to this.
Thanks
Hi,
try this
tell application "Adobe InDesign CS3"
get geometric bounds of page items of document 1
-- or, if there are only text boxes
get geometric bounds of text frames of document 1
end tell
geometric bounds are a list of four values: {y1, x1, y2, x2}
Ok, So how do I get the results to display? Actually I need to export the results to a txt, xml or csv file.
Thanks!
this script writes the ID and the bounds into a text file
tell application "Adobe InDesign CS3"
set {theBounds, theID} to {geometric bounds, id} of text frames of document 1
set theName to name of document 1
end tell
set theFile to ((path to desktop as Unicode text) & theName & ".txt")
set {TID, text item delimiters} to {text item delimiters, space}
repeat with i from 1 to count theBounds
write_to_disk from (((item i of theID as text) & tab & item i of theBounds as text) & return) into theFile
end repeat
set text item delimiters to TID
on write_to_disk from theData into theFile
try
set ff to open for access file theFile with write permission
write theData to ff starting at eof
close access ff
return true
on error
try
close access file theFile
end try
return false
end try
end write_to_disk