Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created August 11, 2009 13:51
Show Gist options
  • Select an option

  • Save subtleGradient/165830 to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/165830 to your computer and use it in GitHub Desktop.
Refresh browsers from the shell
### Created by Thomas Aylott - http://subtleGradient.com
# Requires you to have Parallels or VMWare with Coherence or whatever
# Rename your explorer.app (or whatever) to "Internet Explorer 6.app"
osascript -e 'activate application "Internet Explorer 6"' -e 'tell application "System Events" to key code 96 -- F5 key' -e 'delay 1' &>/dev/null
echo "Internet Explorer 6 Refreshing…"
### Created by Thomas Aylott - http://subtleGradient.com
### Enjoy
osascript -e 'activate application "Remote Desktop Connection"' -e 'tell application "System Events" to tell process "RDC" to key code 96 -- F5 key' &>/dev/null &
echo "Remote Desktop Refreshing…"
# Taken from some random TextMate bundle
# Check if Safari is running, if so refresh
ps -xc|grep -sq Safari && osascript -e 'tell app "Safari"' -e 'do JavaScript "window.location.reload();" in first document' -e 'end tell'
echo "Safari Refreshing…"
# Taken from some random TextMate bundle
# Check if WebKit is running, if so refresh
ps -xc|grep -sq WebKit && osascript -e 'tell app "WebKit"' -e 'do JavaScript "window.location.reload();" in first document' -e 'end tell'
echo "WebKit Refreshing…"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment