Skip to content

Instantly share code, notes, and snippets.

@agoddard
Created March 19, 2013 21:13
Show Gist options
  • Save agoddard/5200195 to your computer and use it in GitHub Desktop.
Save agoddard/5200195 to your computer and use it in GitHub Desktop.
warns you when you have too many tabs open
property tCounter : 0
tell application "Google Chrome"
--Variables
set windowCount to number of windows
set docText to ""
--Repeat for Every Window
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
--Repeat for Every Tab in Current Window
repeat with y from 1 to tabcount
--Get Tab Name & URL
set tCounter to tCounter + 1
end repeat
end repeat
end tell
tell application "Safari"
--Variables
set windowCount to number of windows
set docText to ""
--Repeat for Every Window
repeat with x from 1 to windowCount
set tabcount to number of tabs in window x
--Repeat for Every Tab in Current Window
repeat with y from 1 to tabcount
--Get Tab Name & URL
set tCounter to tCounter + 1
end repeat
end repeat
end tell
if (tCounter < 5) then
display dialog "shit is good, carry on." & tCounter & "tabs isn't bad"
else
display dialog "LULWTF, close some tabs, you have " & tCounter & "tabs open!"
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment