• 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: Detecting if text is styled
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Detecting if text is styled


  • Subject: Re: Detecting if text is styled
  • From: Kai Edwards <email@hidden>
  • Date: Wed, 27 Nov 2002 03:01:23 +0000

on Tue, 26 Nov 2002 20:13:03 +0100, Emmanuel <email@hidden> wrote:

> At 1:36 PM -0500 26/11/02, Arthur J. Knapp wrote:
>>> Date: Tue, 26 Nov 2002 09:30:02 -0600
>>> From: ehsan saffari <email@hidden>
>>> Subject: Detecting if text is styled
>>
>>> In vanilla AS, is there any method avaialble to detect if a piece of text
>>> is styled?
>>
>> on ClassCode(v)
>> (*
>> * HACK !!!
>> *)
>> return ({{p:v}} as string)'s text 39 thru 42
>> end ClassCode
>>
>> on IsStyledText(v)
>> return ClassCode(v) = "STXT"
>> end IsStyledText
>>
>> IsStyledText(the clipboard) --> true/false
>
> OMM, "x as record" fails if x is a string, and returns the famous
> "{<<class ktxt>>:"blah", +class ksty;:dreadful data} if x is styled
> text. Or, is it Smile? (Smile supports "as styled text")


I'm afraid it fails OMM, too. Is there any reason why this failure couldn't
be exploited to test for styled text? Perhaps something like this:

====================

on IsStyledText(txt)
try
txt as record
true
on error
false
end try
end IsStyledText

====================

Kai

--
email@hidden
email@hidden
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Detecting if text is styled
      • From: Kai Edwards <email@hidden>
  • Prev by Date: Re: (Repost) Distributing 'recreatored' script apps...
  • Next by Date: Re: Kindershell
  • Previous by thread: Re: Detecting if text is styled
  • Next by thread: Re: Detecting if text is styled
  • Index(es):
    • Date
    • Thread