• 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: Safari — get selected text in text area
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safari — get selected text in text area


  • Subject: Re: Safari — get selected text in text area
  • From: Jeremy K Sellors <email@hidden>
  • Date: Sat, 30 Apr 2005 14:18:14 -0700

Ok, I see from a previous post:
tell application "Safari"
activate
--set clipText to (do JavaScript "getSelection()" in document 1) as string
tell application "System Events" to keystroke "c" using {command down}
delay 0.5
set clipText to (the clipboard) as text
end tell
Posted by D. Mahaffy under subject Re: Safari "do javascript" busted?
This will work in this case. Thanks.


On Apr 30, 2005, at 12:36 PM, Jeremy K Sellors wrote:

Hi'
How do you set a variable to the selected text in a web content management system (CMS) page text entry area.
--<a href="http://www.canfor.com/">here…</a>
set Link to the clipboard
tell application "Safari"
tell front document
set LinkedText to get the selected
end tell
end tell
set WebLink to "<a href=\"" & Link & "\">" & LinkedText & "</a>"
set the clipboard to WebLink

_______________________________________________
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
 _______________________________________________
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: 
 >Safari — get selected text in text area (From: Jeremy K Sellors <email@hidden>)

  • Prev by Date: Re: Recovering Run Only script
  • Next by Date: Finder's Find still b0rken
  • Previous by thread: Safari — get selected text in text area
  • Next by thread: Finder's Find still b0rken
  • Index(es):
    • Date
    • Thread