How to count the number of Chrome tabs in all windows?

I saw that the CHROMETABCOUNT function returns the numbers of Chrome tabs in the front window, but is there a way to count the number of Chrome tabs in all windows?

Try this AppleScript:

tell application "Google Chrome"
    set totalTabs to 0
    set allWindows to every window
    repeat with aWindow in allWindows
        set totalTabs to totalTabs + (count of tabs of aWindow)
    end repeat
end tell
return totalTabs

3 Likes

Thanks, @noisneil! This is working well. I appreciate it.

Hi @noisneil, could you also write an AppleScript that counts the total number of tabs in the current chrome window only?

Thanks,
ChrisQ

Sure!

tell application "Google Chrome"
	set frontWindow to front window
	set tabCount to count of tabs of frontWindow
end tell
return tabCount

2 Likes

Thank you :slight_smile: