On Oct 3, 2007, at 3:55 PM, Stockly, Ed wrote:

> I'm working on a script that controls Safari, Firefox and/or iCab.
>
> When any of these browsers display pages that have some specific ads  
> and
> javascript they will crash or cause the Finder to crash.
>
> My script can detect when the browser or the finder have  
> unexpectedly quit
> and can clear the dialog and relaunch.
>
> What I can't do is figure out how to determine if the browser has  
> frozen and
> is not responding, and how to force quit the browser.
>
Try this

with timeout of 15* seconds
	get application "Safari"
on error
	KillSafari()
end

do shell script "killall Safari"

> I'm also looking for a way to force restart the mac, without  
> worrying about
> saving or logging off nicely.
>

do shell script "shutdown -r now" password "password" with  
administrator privileges

> These scripts are running on mac minis who's only functon in life is  
> to
> display web pages.
>
> Any suggestions?
>
> ES
>