Created
March 19, 2013 21:13
-
-
Save agoddard/5200195 to your computer and use it in GitHub Desktop.
warns you when you have too many tabs open
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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