Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

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

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

    
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
add comment

1 Answer

up vote 0 down vote accepted
--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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.