• 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: Web text to word
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Web text to word


  • Subject: Re: Web text to word
  • From: email@hidden
  • Date: Wed, 16 Nov 2005 06:01:13 -0500

Dor,

I thought this would be a simple thing to do, and it may be simple in Word 2004, but I only have Word v.X, and everything I tried was either failing entirely, failing half the time, or producing garbled results.  The only clean way I found to accomplish this task on my machine was to pass the text through both TextEdit and 10.4 Tiger's 'textutil' before opening a temporary file in Word.  This isn't a particularly concise script, nor is it terribly obvious, but it works, and the results are on par with what you'd get using Word's 'paste special' feature.

Michael Henley

"/tmp/my_doc.txt"
set my_file to POSIX file result
tell application "Safari"
open location "http://news.google.com/"
delay 5 -- wait for page to load, adjust as needed
set my_text to the text of the front document
end tell
tell application "TextEdit"
-- NOTE: this step only works correctly if you've set TextEdit
-- preferences to use 'Plain Text' for the new document format.
set my_doc to make new document with properties {text:my_text}
close my_doc saving in my_file
end tell
do shell script "cd /tmp; textutil -convert rtf -font Times -fontsize 10 my_doc.txt"
"/tmp/my_doc.rtf"
set my_file to POSIX file result
tell application "Microsoft Word" to open my_file


On Nov 15, 2005, at 23:07:07, dor kelman wrote:

Hello, I am new to applescript. I have tried reading how to do this but I
cant figure it out. I want to copy all the text in my current safari web
page and put it into ms word. So far all I have is:

Tell application "Safari"
Open location "http://news.google.com"
--here I need to copy the text
End tell

I know this is nothing out of what I want to do, but can someone help me?

 _______________________________________________
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: 
 >Web text to word (From: dor kelman <email@hidden>)

  • Prev by Date: Re: arrange icons on desktop
  • Next by Date: Re: Using a prompt value from another handler
  • Previous by thread: Web text to word
  • Next by thread: Re: Web text to word
  • Index(es):
    • Date
    • Thread