How to get the PID of every window of every process

applescript

I'm using the following simple script:

tell application "System Events" to get the title of every window of every process

Which works by printing titles of every window (the same with position). Is there any similar way of printing process id (to which it belongs) of each window, using AppleScript?

Best Answer

You want unix id. Like this...

tell application "System Events" to get unix id of every process

PS: Realize that not all "windows" returned by your original code are visible. So depending what you are trying to do you may want to also look into

https://stackoverflow.com/questions/14551419/listing-all-windows-of-all-applications

Google will give you other examples...