• 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 scripting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safari scripting


  • Subject: Re: Safari scripting
  • From: Craig Williams <email@hidden>
  • Date: Thu, 27 Aug 2009 08:50:02 -0600

From: Timofey Danshin
Hello.  I want to create a button in Safari that would, when pressed, copy the text of the web-page open in Safari into a new Pages document
tell application "Safari"
set safari_text to (do _javascript_ "getSelection()" in document 1)
end tell

if safari_text is "" then
tell me to activate
display dialog "There was nothing selected in Safari." & return & ¬
"Exiting script" buttons {"Ok"} default button 1
return
end if

tell application "Pages"
set body text of document 1 to safari_text
end tell

hth,

Craig Williams
 _______________________________________________
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

  • Prev by Date: Scripting Mail.app Mailbox Pane?
  • Next by Date: Re: How do you display the IP Address?
  • Previous by thread: Re: Safari scripting
  • Next by thread: Re: Safari scripting
  • Index(es):
    • Date
    • Thread