MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/applescript/comments/11dt4ew/help_get_all_windows_of_the_visible_process_but/
r/applescript • u/marksteve4 • Feb 28 '23
As title, I run this script
tell application "System Events" set allWindows to every window of every process whose visible is true end tell
But the output are all empties. Any suggestions?
2 comments sorted by
2
This can happen if Script Editor.app hasn't been authorized in System Preferences > Privacy & Security > Privacy tab > Accessibility list.
If you see Script Editor.app in that list, try this:
This process will refresh Script Editor's entry in the Accessibility database and make sure it's not getting blocked.
If it still doesn't work, try rebooting.
If it still doesn't work, check Console.app to see if it explains why Script Editor is being blocked.
P.S. You may also need to add Script Editor.app to System Preferences > Privacy & Security > Privacy tab > Screen Recording.
I wrote this all from memory, so the names of these places in Settings may be slightly different.
1
You need some brackets, since the whose clause applies to process, not to window:
whose
process
window
tell application "System Events" set allWindows to every window of (every process whose visible is true) end tell
It's a good idea to always use brackets for these complicated element specifiers - from experience I can tell you it will save you some headaches.
2
u/AmplifiedText Feb 28 '23
This can happen if Script Editor.app hasn't been authorized in System Preferences > Privacy & Security > Privacy tab > Accessibility list.
If you see Script Editor.app in that list, try this:
This process will refresh Script Editor's entry in the Accessibility database and make sure it's not getting blocked.
If it still doesn't work, try rebooting.
If it still doesn't work, check Console.app to see if it explains why Script Editor is being blocked.
P.S. You may also need to add Script Editor.app to System Preferences > Privacy & Security > Privacy tab > Screen Recording.
I wrote this all from memory, so the names of these places in Settings may be slightly different.
1
u/mad_scrub Mar 07 '23
You need some brackets, since the
whoseclause applies toprocess, not towindow:It's a good idea to always use brackets for these complicated element specifiers - from experience I can tell you it will save you some headaches.