2

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.

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

The above script prints missing value

{{}, {}, {}, {}, {}, {}, {missing value, missing value}, {}, {missing value}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {missing value, missing value}, {missing value}, {}, {}, {missing value, missing value}, {missing value}, {missing value, missing value}, {}, {}, {}, {}, {}, {}, {}, {}}

How can I get the window id of every window?

Is it possible to get the window id and window title at a time?

3

Yes, you can get the window id and window title at the same time:

tell application "System Events" to get the {title, id} of every window of every process

However, many/most processes are invisible ones, so you'll want to reduce your list:

tell application "System Events" to get the {title, id} of every window of (every process whose visible is true)

And further, id is not something set in most windows. Perhaps you can say more about what you're trying to accomplish. You can examine the potential window properties with:

tell application "System Events" to get the properties of every window of (every process whose visible is true)
4
  • id value is missing. {{missing value}, {missing value, missing value}, {missing value, missing value, missing value, missing value}, {missing value}, {missing value, missing value}, {missing value}, {missing value}, {missing value}} – Vishnu Oct 1 '15 at 8:37
  • Yes, I already told you. "id" is not a property set for windows in the UI typically. There is not id property. If you say more about what you're trying to accomplish, then maybe we could help further. – jweaks Oct 1 '15 at 16:13
  • I don't know about OP, but I just need a consistent way to identify and differentiate between all (visible) windows. I'm writing an applescript to track and rearrange windows, and there are 2 issues: 1. window names/titles change (e.g. Safari) and 2. some windows have the same name (e.g. Terminal). If you know how to consistently and uniquely refer to a window, I could use a tip. Otherwise, I'm just going to have to skip windows I can't uniquely identify. – hepcat72 Feb 23 at 16:24
  • I should also point out that the identification method needs to survive a reboot... – hepcat72 Feb 23 at 16:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .