fred_mouse: text 'survive ~ create' below an image of a red pencil and a swirling rainbow ribbon (create)

I've been doing a very half-arsed exploration of apple script. A while ago I wrote two tiny (as in 'three lines of code' tiny) scripts, one of which counted all open tabs, and the other counted open tabs in the front window. And I used these for a while, and was happy.

And then a week or two ago I decided it was time to try combining these. My first pass worked, but I wasn't as happy with it as I might have been. Today, I've tweaked it just a little bit more. And I ran it, and got the output

"There are 461 open tabs, in 36 windows. 241 of these are in the front tab"

The code:

tell application "Safari"
    set frontTabs to count of tabs of front window
    set windowCount to count of window
    set allTabs to count of tabs of every window
    set tabText to "There are " & ¬
        allTabs & ¬
        " open tabs, in " & windowCount & " windows. " & ¬
        frontTabs & ¬
        " of these are in the front tab"

end tell
tabText

Profile

fred_mouse: line drawing of sheep coloured in queer flag colours with dream bubble reading 'dreamwidth' (Default)
fred_mouse

April 2026

S M T W T F S
   12 34
5 67891011
121314151617 18
1920212223 24 25
2627282930  

Syndicate

RSS Atom

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags