• 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
Re: Closing Safari Tab...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Closing Safari Tab...


  • Subject: Re: Closing Safari Tab...
  • From: Christopher Stone <email@hidden>
  • Date: Sat, 10 Dec 2011 16:36:10 -0600

On Dec 10, 2011, at 15:42, David Crowe wrote:
I am having difficulty closing tabs in a Safari window with multiple tabs.
{snip}
What I'd really like to do is close all tabs other than the current one. While I can do that through ctrl-clicking on the tab, automating it is another matter.

Thanks for any assistance.
______________________________________________________________________

Hey David,

Which Mac OS and which Safari?

Give this a try:

try
tell application "Safari"
tell front window
if it's document ≠ missing value then
set tabURL to URL of current tab
close (every tab whose URL ≠ tabURL)
end if
end tell
end tell
on error errMsg number errNum
set {cr, sep} to {return, "------------------------------------------"}
set e to sep & cr & "Error: " & errMsg & cr & sep & cr & "Error Number: " & errNum & cr & sep
beep
display dialog e
end try

--
Best Regards,
Chris

 _______________________________________________
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

References: 
 >Closing Safari Tab... (From: David Crowe <email@hidden>)

  • Prev by Date: Is dock visable [sic] [visible]
  • Next by Date: Re: Files Locked with Lion?
  • Previous by thread: Closing Safari Tab...
  • Next by thread: Re: Closing Safari Tab...
  • Index(es):
    • Date
    • Thread