New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Operating System General OS operation information and support

Apple-Script question


Post Reply New Thread Subscribe

 
Thread Tools
Markuse

 
Member Since: May 20, 2011
Posts: 10
Markuse is on a distinguished road

Markuse is offline
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
QUOTE Thanks
McYukon

 
McYukon's Avatar
 
Member Since: May 14, 2009
Location: Near Whitehorse, Yukon
Posts: 2,053
McYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to behold
Mac Specs: 2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9

McYukon is offline
You would need to add a shortcut for the "Reset Safari" menu item in System Preferences>Keyboard>Keyboard Shortcuts


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

Use the reputation system if a post helps you!
Mac Forums IRC Channel - Help build it by hanging out with us
The next sentence is true. The previous sentence is false.
QUOTE Thanks
McYukon

 
McYukon's Avatar
 
Member Since: May 14, 2009
Location: Near Whitehorse, Yukon
Posts: 2,053
McYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to beholdMcYukon is a splendid one to behold
Mac Specs: 2012 MBP i7 2.7 GHz 15" Matte - 16 GB RAM - 120 GB Intel SSD - 500 GB DataDoubler Mac OS 10.9

McYukon is offline
Oh and those three … aren't simple dots. It's made with option+;

Use the reputation system if a post helps you!
Mac Forums IRC Channel - Help build it by hanging out with us
The next sentence is true. The previous sentence is false.
QUOTE Thanks
Markuse

 
Member Since: May 20, 2011
Posts: 10
Markuse is on a distinguished road

Markuse is offline
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)
QUOTE Thanks

Post Reply New Thread Subscribe


« I cant modify my partition size. | Is Tiger causing my slowdown? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Quick Apple Script Question ezhangin OS X - Development and Darwin 2 03-22-2006 07:34 PM

All times are GMT -4. The time now is 08:26 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?