Re: getting selection in Safari
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