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

Re: getting selection in Safari


  • Subject: Re: getting selection in Safari
  • From: Christian Vinaa <email@hidden>
  • Date: Tue, 31 Jan 2006 13:03:23 +0100


 > Excuse my ignorance, but is it possible that one cannot get a reference to
 > the selection in Safari?


the following works for me ( in another context ! )

perhaps you can work with this ?


set myData to ""

tell application "Safari"
	activate
	set myUrl to URL of document 1
	--line below suggested by Lankhmart on macosxhints
	set myData to do JavaScript "getSelection();" in document 1
	if myData is "" then
		set myData to text of document 1 as text
	end if
end tell

set myDate to current date
set fPath to path to desktop
set fName to (do shell script "date \"+%Y-%m-%d\"") & ".txt"
set myFile to open for access file ((fPath as string) & fName) with write permission
write "=== " & return & "Date: " & myDate & return & "Text from: " & myUrl & return & return & myData & return & return to myFile starting at eof
close access myFile
beep


--
Christian Vinaa

...... Meanwhile, aunt Martha, having taken a tramp in the woods,
is lying in a ditch at the edge of town .........................
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: getting selection in Safari (From: Timothy Bates <email@hidden>)

  • Prev by Date: Re: getting selection in Safari
  • Next by Date: Re: getting selection in Safari
  • Previous by thread: Re: getting selection in Safari
  • Next by thread: Re: getting selection in Safari
  • Index(es):
    • Date
    • Thread