I can't see anything immediately wrong with your script, so I don't know why it fails when you add the Overflowed check. You should not need to have the table selected. So, let me ask some general questions, perhaps to inspire some thinking towards a solution:
- In your "alert("cell overflow Will Robinson!");" snippet, you do not show the additional closing brace that would be required. But, I assume you would have known right away if that was omitted.
- When you enhanced the script to iterate over all tables, how do you know that you actually iterated over all tables? Did you actually click through every single cell in the document? There are many tables on the reference pages that your script may pick up before it gets to the body pages. Did you click through a bunch of "gimme a cell" messages and then decide the "cell overflow Will Robinson!" message wasn't working, but actually you had not gotten to the offending table yet?
Here are a few additional troubleshooting suggestions:
- When troubleshooting with alert boxes, I always use confirm() instead, so I can abort the process at any point, For example:
if(!confirm("gimme a cell")) return;
- It is often more informative to report a property of an object, rather than just a static message. For example, if you want to verify that you have a table on a body page, you could do:
alert("gimme a table. Table format: " + tbl.TblTag);
- Although cumbersome to use, you could run this script through the ES toolkit debugger. The debugger would show you all properties of all active objects, so you could evaluate the Overflowed property of a cell object to see what the interface actually sees.
I hope this helps some.