• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Script to clear Safari?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Script to clear Safari?


  • Subject: Script to clear Safari?
  • From: email@hidden
  • Date: Mon, 22 Feb 2016 09:14:13 -0800

AppleScript Users,

I am looking for help to create an AppleScript which I can save in
Automator as an application. I would like the AppleScript to do two
things:
1) If any Safari windows & tabs are open, close them all;
2) Clear the cookies, cache, and history.

I've cobbled together a script that throws an error, but does accomplish
the clear history task. I tried Automator's follow my action/record
function, but the result won't work if the Safari window isn't in the
exact same place on the screen.

on run {input, parameters}
    tell application "System Events"
        tell process "Safari"
            set frontmost to true
            click menu item "Clear History…" of menu 1 of menu bar item
"Safari" of menu bar 1
            delay 1
            click button "Clear History" of window 1
        end tell
    end tell
    return input
end run

Anyone have a suggestion on how to script Safari to "close windows" and
"clear history"?

Thanks,
Douglas Bat


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


  • Follow-Ups:
    • Re: Script to clear Safari?
      • From: 2551phil <email@hidden>
    • Re: Script to clear Safari?
      • From: "Stockly, Ed" <email@hidden>
  • Prev by Date: Re: Watch Folder questions
  • Next by Date: Re: Script to clear Safari?
  • Previous by thread: Attaching file to email changes links in email
  • Next by thread: Re: Script to clear Safari?
  • Index(es):
    • Date
    • Thread