WINDOWCOUNT() but just for the current space?

temp is a list that contains 1 item.

Here's the AppleScript code in Script Debugger, a highly recommended application that is far superior to Apple's Script Editor.


I should note that I used simplier AppleScript originally, but @seishonagon encountered a situation where WhichSpace inexplicably returned a three-item list. I’ve never been able to reproduce this issue, but the revised script that @seishonagon shared works well in both cases thus I changed the aforementioned macro set to use this revision.

1 Like