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.

link|improve this question
is this something I need to do? – Nick May 16 '11 at 9:51
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 May 16 '11 at 12:23
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 – Nick May 16 '11 at 13:59
feedback

migrated from stackoverflow.com May 16 '11 at 14:09

This question came from our site for professional and enthusiast programmers.

1 Answer

--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
link|improve this answer
feedback

Your Answer

 
or
required, but never shown