Apple-Script question

Joined
May 20, 2011
Messages
10
Reaction score
0
Points
1
Hello everybody,

I have a question regarding Apple-script.
For the more advanced users it should be a simple task i guess.
Basically i need a script that refreshes Safari (Firefox would be ok, as well) automatically and deletes the cookies afterwards... what i have by now is this:

repeat
tell application "Safari"
activate
end tell

tell application "System Events"
tell process "Safari"
keystroke "r" using {command down}

delay 120
end tell
end tell
end repeat

I just can't figure out how the shortcut for "delete cookies" can be done...

Thank you very much for your help in advance... oh and just in case, this is no script to be used to bring a server down or similar. It's to help me checking my planned music-social-network platform.

Cheers,

m
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
You would need to add a shortcut for the "Reset Safari" menu item in System Preferences>Keyboard>Keyboard Shortcuts
content


And then you can call it from applescript like this

Code:
tell application "Safari"
	activate
end tell
try
	tell application "System Events"
		tell process "Safari"
			
			key down command
			key down shift
			keystroke "r"
			key up command
			key up shift
			click (click at {900, 525})
		end tell
	end tell
on error errmsg
end try
 
Joined
May 14, 2009
Messages
2,052
Reaction score
136
Points
63
Location
Near Whitehorse, Yukon
Your Mac's Specs
2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9
Oh and those three … aren't simple dots. It's made with option+;
 
OP
M
Joined
May 20, 2011
Messages
10
Reaction score
0
Points
1
Sir, i bow to you!
Thank you very much for your perfect explanation, that was very helpful to me.
Have a great day,
Thank you once more,
All the best, cheers!
markus
(reputation used, of course)
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top