Limiting number or closing oldest open Safari windows

2

1

My son is autistic and opens so many new Safari windows playing flash movies that his MacBook often becomes so unresponsive that it's faster to hard reboot it than wait for the force quit dialog to come up.

Is there a way that I could either limit the amount of windows that he can open, or even set a periodic job to close the oldest open ones leaving a certain amount open?

I know absolutely no AppleScript, any pointers would be welcome.

Nick

Posted 2011-05-15T09:42:54.533

Reputation: 123

is this something I need to do? – None – 2011-05-16T09:51:34.217

technically you could create an AppleScript that could do this for you but I think Annie has shown you some good alternatives that don't require you to write something new – mcgrailm – 2011-05-16T12:23:01.157

though not for Safari, installing more browsers doesn't seem like a solution, though I will try them out, on initial reading I'm not sure they do what I require. The technical bit was why I asked here – None – 2011-05-16T13:59:15.090

Answers

0

--This script will limit the number of Safari windows you can open

tell application "Safari"
    repeat
        if the count of every document is greater than [number] then
            repeat until the count of every document is [number]
                close the front document
            end repeat
        end if
    end repeat
end tell

fireshadow52

Posted 2011-05-15T09:42:54.533

Reputation: 185