Empty Cache in Safari

Hi everyone,

I’m writing a script to empty the cache in Safari before running some other command within the browser. Anyways my question is this, how do I access both the command and option key down simultaneously while pressing the “e” key? I’ve tried using command down and option down as handlers but that didn’t seem to work, and there’s no specific key codes for function keys as far as I know. I’d love to bypass this altogether by telling Safari to simply “empty cache” but it doesn’t recognize the cache command.

Thanks,
Anthony

Model: MacBook
AppleScript: 2.2
Browser: Safari 525.13
Operating System: Mac OS X (10.5)

I need to be patient. Being on this site too late at night isn’t helping either. :confused:

The answer was found here by Kevin Wolfe:

http://bbs.macscripter.net/viewtopic.php?id=14951

which demonstrates the following:

--Empty Safari's cache
tell application "System Events"
tell application "Safari" to activate
tell process "Safari" to keystroke "e" using command down & option down
delay 1
keystroke return
end tell

Hi,

I don’t know, where the cache is located in Leopard (I’m currently “on the road” with my Tiger-PowerBook ;))
but probably it’s easier to empty the cache this way

do shell script "rm -rf /path/to/cache/Folder/"

Hi Stefan, This MacFixIt thread might help you locate Safari’s cache on Leopard.
Safari 3.1/Leopard 10.5.2 browser cache location?

Tom

Browser: Camino 1.6
Operating System: Mac OS X (10.4)