count windows of a running app

hi,

I am trying to write a script for resizing the windows of a running program.

Now I have a problem with;

count window

in TextEdit I get a 1 when there is only one window - a 2 when there are two windows … thats fine…
But in iTunes I get a 2 when there is only one window.

In R (statistic-program) I get a 12 when there is only one window open …

can someone help me on that?
How can I get the real number of currently existing windows of a program?

You don’t post your code, but this works for me:

tell application "System Events" to tell process "iTunes" to set I to count windows