• 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: Class ksty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Class ksty


  • Subject: Re: Class ksty
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 7 Aug 2008 00:26:48 -0700

On Aug 6, 2008, at 8:43 PM, Philip Aker wrote:

On Aug 6, 2008, at 8:30 PM, Laine Lee wrote:

OK, please suggest how I might accomplish a Leopard fix for this script adapted from a script by julifos, which worked quite well (at least to some extent) through Tiger, for example:

on monostyle(theText)
set the clipboard to (theText as international text)
set ss to (the clipboard as record)
scrap styles of ss
end monostyle
monostyle("some text")

Or, to elaborate a bit further, where you're currently doing this:

set clipContents to (the clipboard) as styled text
copy StyledTextToRecord(clipContents) to styleInfo

to StyledTextToRecord(clipContents)
set clipContents to clipContents as record
copy «class ktxt» of clipContents to ktxt
copy xToString(«class ksty» of clipContents) to ksty

...do something more like this:

copy StyledClipboardToRecord() to styleInfo
to StyledTextToRecord()
copy (the clipboard as string) to ktxt
copy (the clipboard as scrap styles) to ksty

The basic point is that you can treat the clipboard contents themselves as a record (either by fetching the entire record as Mr. Aker does, or by fetching specific pieces like I do), instead of relying on AppleScript to preserve the style data when you get "text" from the clipboard.  This technique should work equally well on older systems.

Alternatively, figure out how to paste the text into TextEdit and save it as HTML, since it can do that these days.


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

  • Follow-Ups:
    • Re: Class ksty
      • From: Laine Lee <email@hidden>
References: 
 >Re: Class ksty (From: Laine Lee <email@hidden>)
 >Re: Class ksty (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: InDesign CS3 export as JPEG - selection only
  • Next by Date: Re: Words of Bug in Leopard (Japanese environment)
  • Previous by thread: Re: Class ksty
  • Next by thread: Re: Class ksty
  • Index(es):
    • Date
    • Thread