getting list of open windows

I want to get a list of windows that are currently open in Mac OSX. how is this done?

Hi,
try this!

tell application "Finder"
	set mywindowlist to the name of every window
	choose from list mywindowlist
end tell

is finder really necessary? i thought finder was just another app. is there a list just maintained by darwin?

here is another way, with the Finder you get only the Finder windows

tell application "System Events"
	set allWindows to name of window of processes whose visible is true
end tell
set windowList to {}
repeat with i in allWindows
	repeat with j in i
		if contents of j is not missing value then set end of windowList to contents of j
	end repeat
end repeat