October 4, 2006

Nifty Safari / AppleScript trick for client-side auto-refresh

All I needed was a simple way for Safari to refresh the current page at fixed intervals.
Luckily, it's scriptable...

on idle
-- the applescript only calls attention to itself when the idle period is up

tell application "Safari"
--confirms your browser is the front application
		activate
	end tell
	
	tell application "System Events"
		tell process "Safari"
			keystroke "r" using {command down}
		end tell
	end tell
--sets the idle period in seconds. i.e. safari will refresh every 10 seconds
	return 10
end idle
Posted by cbrown at October 4, 2006 12:24 PM
Comments