How to List All Windows of One App That Are Open in All Desktops

If you prefer AppleScript, it is, as usual, a bit messier – requiring more work, but still possible:

on run
    tell application "TextEdit" to my intercalate("|", name of windows)
end run



-- intercalate :: String -> [String] -> String
on intercalate(delim, xs)
    set {dlm, my text item delimiters} to ¬
        {my text item delimiters, delim}
    set s to xs as text
    set my text item delimiters to dlm
    s
end intercalate

or

on run
    tell application "TextEdit" to my intercalate(linefeed, name of windows)
end run



-- intercalate :: String -> [String] -> String
on intercalate(delim, xs)
    set {dlm, my text item delimiters} to ¬
        {my text item delimiters, delim}
    set s to xs as text
    set my text item delimiters to dlm
    s
end intercalate
1 Like