Monday, August 26, 2019

#1 2018-12-01 06:14:36 pm

Registered: 2010-09-06
Posts: 4

AS counts Finder window tabs as windows in Mojave

If I have one Finder window with two tabs open in High Sierra, the script below will return 1:


tell application "Finder" to count windows

In Mojave it returns 2 — but it won't split the tabs into separate windows if I manipulate their bounds separately. Which means my trusty old dual window script is now broken. And the Finder dictionary still doesn't contain a tab object as such. Does anyone know how to get a count of windows as distinct from tabs in Mojave?

Browser: Safari 605.1.15
Operating System: macOS 10.14

Filed under: Finder, windows, tabs



#2 2019-02-01 12:51:15 pm

Registered: 2011-08-20
Posts: 3

Re: AS counts Finder window tabs as windows in Mojave

Here is a little work around that may work for you.  This code will return the total tab count of all tabs in every finder window combined.  It will also return the number of open finder windows, and will return the name of the active tab in each finder window.


global tabCountRef, totalTabs, windowNames, totalWindows


on totalWindowCount()
   tell application "Finder"
       repeat until application "Finder" is frontmost
           delay 0.1
       end repeat
   end tell
   tell application "System Events"
       repeat until radio buttons of tab group 1 of window 1 of application process "Finder" exists
           delay 0.1
       end repeat
       set tabCountRef to a reference to radio buttons of tab groups of windows of application process "Finder"
       set totalTabs to count of tabCountRef
       set windowNames to name of windows of application process "Finder"
       set totalWindows to count of windowNames
   end tell
end totalWindowCount



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)