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" 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" --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?
|