Will,I was looking through the TextEdit dictionary and didn't find anything to do with page counting. You could probably have your script do some math where it counted the number of lines and divided that by the number of lines per page. That's not very reliable though as I believe that it misses the number of blank lines in that count.
Later... Tim Kilburn & Carter the Canine Fort McMurray, AB Canada