• 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: Styled text and non-Gregorian dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Styled text and non-Gregorian dates


  • Subject: Re: Styled text and non-Gregorian dates
  • From: Philip Aker <email@hidden>
  • Date: Wed, 6 May 2009 08:54:57 -0700

On 2009-05-05, at 17:28:33, Mark J. Reed wrote:

Awesome.  I hate exercise.  Thanks. :)

I've heard it said that a laughing is a reasonable substitute.


You can avoid a level of quoting by using a here-document:

set rtf to (do shell script "textutil -stdin -stdout -convert rtf <<EOF
<html><head><title>Regular Exercise</title><style type='text/css'>body
{font-family:Papyrus;font-size:21pt;}</style></head><body>Visit the <a
href=''">http://en.wikipedia.org/wiki/Giza_pyramid_complex'>pyramids</a></body></html>
EOF")

I definitely wanted to separate the HTML content variable because folks might want to assemble the content by various means. So the stages are:

1. HTML
2. RTF
3. clipboard
4. process with app

Using the 'here document' would be more succinct, however I'm having trouble getting it to work with a variable -- seems to be a quoting problem. Also the RTF output seems different. Here's a full script:

set html to quoted form of "<html><head><title>Regular Exercise</title><style type='text/css'>body {font-family:Papyrus;font-size:21pt;}</style></head><body>Visit the <a href=''">http://en.wikipedia.org/wiki/Giza_pyramid_complex'>pyramids</a></body></html>"

set rtf to (do shell script "echo " & html & "| textutil -stdin -stdout -convert rtf ")

-- Changed line causes problems. 
--set rtf to (do shell script "textutil -stdin -stdout -convert rtf <<EOF\n" & html & "\nEOF\n")

set the clipboard to (run script (do shell script "tclsh <<< 'binary scan {" & rtf & "} H* res;puts \"«data RTF $res»\";'"))

tell application "TextEdit" to activate
tell application "System Events" to tell application process "TextEdit"
keystroke "v" using {command down}
end tell


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

 _______________________________________________
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

  • Follow-Ups:
    • Re: Styled text and non-Gregorian dates
      • From: "Mark J. Reed" <email@hidden>
References: 
 >Re: Styled text and non-Gregorian dates (From: Christopher Nebel <email@hidden>)
 >Re: Styled text and non-Gregorian dates (From: Philip Aker <email@hidden>)
 >Re: Styled text and non-Gregorian dates (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Image Resolution
  • Next by Date: Re: Styled text and non-Gregorian dates
  • Previous by thread: Re: Styled text and non-Gregorian dates
  • Next by thread: Re: Styled text and non-Gregorian dates
  • Index(es):
    • Date
    • Thread