I’m working on an InDesign CS3 script that does the following:
Makes a list of all graphic frames in a document
Iterates through the list getting bounds and using those bounds to filter text boxes by size
Applying a fill color to the frames in the second list.
What’s odd is that the second list doesn’t contain all the frames it should, just the first few properly sized graphic frames. The rest of the frames on a test page are exactly the same size. They are included in the first list (every graphic frame) but for some reason, they don’t get included in List2 (subset of every graphic frame whose size matches the criteria.
Have you looked at the returned values for the bounds? A guess is that they are returning a value that is just slightly off of your right size, say by 0.0001, which would make them a different size. I believe that a script will return a more accurate value with more decimal places than you see in the measurements pallet which is rounded up to the nearest thousandths. Look over the values that ID is returning to your script, you may have to round them up or down to get the result that you want.
I think your problem has to do with unit of measure it is best to measure everything in points so this lines measurements should be in points I think your are providing it inches
I tried rounding to three decimal places. Same problem.
I also tried the script with picas in the script and the unit measurement prefs in the doc set to picas. No good either.
I think it has something to do with stack order. Here’s a clue:
If I start with a singe box (1 x .875) and then step-and-repeat that out to eight rows across and then step-and-repeat that row to ten rows down, I have eighty frames. My script then runs perfectly and colors them all.
If I start with that same single box use any of the following methods of duplicating it, the script only colors some of the boxes: cut or copy and paste, option + drag, duplicate.
I tend to agree with Jerome’s assessment, as I’ve dealt with a similar scenario; the control palette can lie to you, even within its decimal display range capability. The coordinates of your original object sounds a little off, possibly due to a rounding error which was, itself, likely caused by a stroke. Did the source frame have a stroke applied when you positioned it? What are the bounds of this frame? If you make a new frame at the size & position that the ID control palette is indicating as coordinates for the current source frame, does the result change?
Thanks for the help. I’ve taken your advice and rounded the differences between the bounds. I just rounded the differences of my two equations. Not very useful if the difference ends up being a negative number, but I’m pretty sure I’m always going to be dealing with positive answers. Anyway, it works and now puts all the frames into List2. Thanks for your help. Here are the two handlers I used to compare and round.