• 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: saving displayed text on a web page as rtf
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: saving displayed text on a web page as rtf


  • Subject: Re: saving displayed text on a web page as rtf
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 05 Jul 2013 08:20:02 -0500

On Jul 5, 2013, at 7:39 AM, 2551 wrote:

That's why I need to find either an rtf or pdf solution. Either will do, but the pdf version is looking simpler going on current responses from the list, just because TextEdit is such a pain to script. Bash's textutil can't seem to manage more than one 'style' at a time…but I'm willing to consider (any) other solutions, from whatever angle (I would love a scripting solution that doesn't need GUI/Assistive Devices actions, but that's looking increasingly unlikely).

Here's a handler I use to print messages to pdf via Mail.
The Print dialog is standard, so this should also work in Safari, too.
The message is already open in Mail when this handler is called.
( tempFileName is some text containing a time stamp.)

on GUIprintToPDF(tempFileName, OSMtLion)
tell application "System Events"
tell process "Mail"
set frontmost to true
-------------------------
keystroke "p" using {command down} -- opens Print dialog
repeat 20 times -- wait for print sheet to appear
delay 1
set frontmost to true
if exists sheet 1 of window 1 then exit repeat
end repeat
if not (exists sheet 1 of window 1) then error "Mail is not responding. The Print dialog failed to appear." --<<<<<
set frontmost to true
-------------------------
set PDFButton to (first menu button of sheet 1 of window 1)
click PDFButton
click menu item 2 of menu 1 of PDFButton -- Save as PDF...
delay 1 -- wait for the Print window
-------------------------
if OSMtLion then
try
set value of text field 1 of sheet 1 of sheet 1 of window 1 to tempFileName --******* for Mt Lion only
on error
error "The pdf document was not created. (in GUIprintToPDF)" --<<<<<<<<<<<<
end try
else
set value of text field 1 of window 1 to tempFileName --******** for Lion and previous
end if
-------------------------
set frontmost to true
keystroke "d" using {command down} -- sets save location to Desktop
keystroke return -- click button "Save"
repeat
delay 1
if not (exists sheet 1 of window 1) then exit repeat
end repeat
end tell
end tell
end GUIprintToPDF ------------------------------------------


 _______________________________________________
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

References: 
 >saving displayed text on a web page as rtf (From: 2551 <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: Kaydell Leavitt <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: 2551 <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: Deivy Petrescu <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: 2551 <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: Luther Fuller <email@hidden>)
 >Re: saving displayed text on a web page as rtf (From: 2551 <email@hidden>)

  • Prev by Date: Re: saving displayed text on a web page as rtf
  • Next by Date: Re: saving displayed text on a web page as rtf
  • Previous by thread: Re: saving displayed text on a web page as rtf
  • Next by thread: Re: saving displayed text on a web page as rtf
  • Index(es):
    • Date
    • Thread