Re: Deleting empty GRAPHIC rectangle in InDesign CS
Re: Deleting empty GRAPHIC rectangle in InDesign CS
- Subject: Re: Deleting empty GRAPHIC rectangle in InDesign CS
- From: Stan Cleveland <email@hidden>
- Date: Tue, 11 Apr 2006 19:05:37 -0700
- Thread-topic: Deleting empty GRAPHIC rectangle in InDesign CS
Title: Re: Deleting empty GRAPHIC rectangle in InDesign CS
On 4/11/06 4:47 PM, email@hidden wrote:
I figured out my problem with Filemaker Pro, so all is well there, but hit another snag. Basically, I've got a script that takes an InDesign template with 24 graphics per page and injects information from found records in Filemaker Pro into this template. Because the templates are 24 items per page, there are usually empty blank graphic boxes left over. I'm trying to delete those, but having no luck. I am able to delete the unused corresponding text boxes just fine, but I can't get InDesign to recognize that these graphic boxes have nothing in them.
I've tried almost every variation I can think of around the premise of:
delete (every page item whose contents is "")
But even if I run a script that compiles, nothing happens.
Does anyone know how to isolate items that have a certain property? When trying to figure out what flag InDesign has for a box that was "empty", I ran a script to get a listing of all the properties of a box that had a graphic in it and one that didn't. The only difference was the property "all graphics:{}". For the empty graphic box, it looked exactly like that. For a placed graphic, it looked like "all graphics:{PostScript picture id 12933 of rectangle id 11719 of page id 8052 of spread id 8047 of document "DocumentName" of application "InDesign CS"}".
Any help or suggestions is appreciated. If I've been too brief and you need more information, please let me know!
Thanks,
Tina
Running InDesign CS on Mac OSX 10.3.9
You can address many InDesign objects by their properties, but not rectangles that contain placed graphics (AFAIK). What you CAN do is cycle through and test a list of object properties. This is one way to do what you need:
tell application "InDesign CS"
tell page 1 of document 1
set rectList to all graphics of rectangles
repeat with i from (count rectList) to 1 by -1
if item i of rectList is {} then — contains no image
delete rectangle i
end if
end repeat
end tell
end tell
Note that the repeat loop must start high and work down to 1 in order to preserve the index number of each rectangle. If you are also using polygons or ovals, you’ll need to reuse the above code for those object types. (There’s no simple way to do them all at one time.)
Stan Cleveland
Color Technology Inc.
Portland, Oregon
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden