• 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: Selection in Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Selection in Safari


  • Subject: Re: Selection in Safari
  • From: Rob Jorgensen <email@hidden>
  • Date: Wed, 25 Jun 2003 19:59:34 -0400

At 8:39 PM +0100 6/25/03, Dave Fitch wrote:
On 24/6/03, Jon Pugh said:
I see we can get the selection in Safari now:

tell application "Safari"
do JavaScript ("return getSelection();") in document 1
end tell

Cheesy, but it works.

Any way to get a list of tabs and associated urls??

It requires UI scripting, it's ugly, and it's less than desirable, but this works for me. Let's hope that Safari is slated for AppleScript improvements which include tab support.

set targetURLs to {}
tell application "Safari" to activate

tell application "System Events" to tell application process "Safari"
set tabNames to name of radio buttons of window 1
end tell

tell application "Safari"
repeat with thisTab in tabNames
tell application "System Events"
tell application process "Safari"
tell radio button named thisTab of window 1 to click
end tell
end tell
copy {aURL:URL of document of window named thisTab, aTab:contents of thisTab} to end of targetURLs
end repeat
end tell
targetURLs

--

Rob Jorgensen
Ohio, USA
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Selection in Safari (From: Dave Fitch <email@hidden>)

  • Prev by Date: Re: Short, maybe even handy, Address Book script
  • Next by Date: Re: Selection in Safari
  • Previous by thread: Re: Selection in Safari
  • Next by thread: Re: Selection in Safari
  • Index(es):
    • Date
    • Thread