• 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 12:34:14 -0700

On 2009-05-06, at 10:21:10, Mark J. Reed wrote:

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.

That's what I meant by "avoid a level of quoting" - you don't want to use 'quoted form of' on the HTML string if you're using the here-document option. You should, however, quote the delimiter in that case (e.g. " <<'EOF' " ) which I failed to do.

Here's the MJJR approach working:

set html to "<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 "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

Doesn't seem to be much of a speed difference (subjective impression) and (bonus :-), saves the extra exercise of typing "quoted form of".


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

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>)
 >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: Scripting MSWord
  • Next by Date: Re: Scripting MSWord
  • Previous by thread: Re: Styled text and non-Gregorian dates
  • Next by thread: "C" language continue statement in applescript
  • Index(es):
    • Date
    • Thread