Re: Styled text and non-Gregorian dates
Re: Styled text and non-Gregorian dates
- Subject: Re: Styled text and non-Gregorian dates
- From: Christopher Nebel <email@hidden>
- Date: Fri, 1 May 2009 14:50:38 -0700
On Apr 29, 2009, at 5:27 PM, Aaron Solomon Adelman wrote:
I'm trying to figure out how to make AppleScript, maybe in
combination with shell script, do two things it does not seem to
want to do at all.
1) Is there any way to use AppleScript to write styled text to the
clipboard? I am specifically seeking a way to put text with a
hyperlink in the clipboard. I already wrote scripts to generate
HTML code, but styled text with a hyperlink would let me paste text
with a link directly into Blogger's WYSIWYG editing mode rather than
having to work in its HTML mode.
If Blogger is scriptable, then it may expose a scriptable
representation of its styled text, and you can manipulate that. You
tend to wind up setting the text first, and then going back and
altering the styles.
If you really meant specifically "paste", that is, working through the
clipboard, then it's possible, but difficult, since it's not really
supported. Basically, you have to come up with a raw-data
representation of the text, and stuff that on to the clipboard.
Pasting a link requires using RTF, which actually simplifies matters a
little since it's based on ASCII text. This example puts "A link
here" on to the clipboard, where "link" is a link to http://www.apple.com:
set the clipboard to «data RTF
7B5C727466310A41207B5C6669656C647B5C2A5C666C64696E73747B48595045524C494E4B2022687474703A2F2F7777772E6170706C652E636F6D227D7D7B5C666C6472736C74206C696E6B7D7D20686572652E7D
»
(That's supposed to be all one line; there's a single space between
"RTF" and the hex data.) Producing the appropriate stream of hex for
your purposes is left as an exercise for the reader. =)
2) Mac OS X 10.4 and 10.5 support multiple calendar systems (Hebrew,
Islamic, Buddhist, etc.; check in the "International" preference
pane). Is there anyway to tap into this capability using
AppleScript? I am having visions of using such power to create iCal
calendars.
It depends on the locale, but given the nature of your question, I
rather doubt it. AppleScript currently uses an older API for dealing
with dates that pre-dates Unicode and can only handle some locales --
basically, any Western European language plus Chinese and Japanese,
and definitely not Hebrew or Arabic.
--Chris Nebel
AppleScript Engineering _______________________________________________
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