Results 1 to 4 of 4
  1. #1


    Member Since
    May 20, 2011
    Posts
    10
    Apple-Script question
    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

  2. #2

    McYukon's Avatar
    Member Since
    May 14, 2009
    Location
    Near Whitehorse, Yukon
    Posts
    2,052
    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


    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.

  3. #3

    McYukon's Avatar
    Member Since
    May 14, 2009
    Location
    Near Whitehorse, Yukon
    Posts
    2,052
    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+;
    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.

  4. #4


    Member Since
    May 20, 2011
    Posts
    10
    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)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Removing Duplicate emails in mail.app (Apple Script).. question
    By notherand in forum OS X - Apps and Games
    Replies: 2
    Last Post: 08-13-2009, 07:39 PM
  2. Apple Script Question
    By Eric Lundquist in forum OS X - Apps and Games
    Replies: 1
    Last Post: 01-28-2009, 11:11 PM
  3. syncing ratings between AAC and Apple Lossless iTunes libraries using Apple Script
    By nick_harambee in forum iPod Hardware and Accessories
    Replies: 0
    Last Post: 10-05-2007, 03:09 PM
  4. Quick Apple Script Question
    By ezhangin in forum OS X - Development and Darwin
    Replies: 2
    Last Post: 03-22-2006, 07:34 PM
  5. Quick Apple Script Question
    By ezhangin in forum OS X - Development and Darwin
    Replies: 6
    Last Post: 12-14-2005, 09:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •