Re: Stupid, Stupid Text Features [Was: Can't set creator type]
Re: Stupid, Stupid Text Features [Was: Can't set creator type]
- Subject: Re: Stupid, Stupid Text Features [Was: Can't set creator type]
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 24 Feb 2004 06:10:45 -0800
On 2/24/04 3:37 AM, "Walter Ian Kaye" <email@hidden> wrote:
>
At 10:46a +0000 02/24/2004, Mr Tea didst inscribe upon an electronic papyrus:
>
>
> Aside from setting creator and file types, are there any other
>
> places where this gotcha is likely to strike?
URLs, as in calls to SOAP; quite possibly in 'open location' as well - IO
haven't checked yet. 'path to' when using those 4-character codes for
obscure locations (or if, like JD, you don't like typing out the standard
special folders). More, I'm sure.
>
>
It hit me in GraphicConverter, when I tried to set comments or IPTC info.
>
>
And it took me, an AppleScript oldtimer, somewhere between a half
>
hour and an hour to figure out where the problem was -- and it was
>
only Script Debugger which gave me a clue; a person using Script
>
Editor might spend hours and still not figure it out.
>
>
I ended up making an all-purpose subroutine:
>
>
on RemoveStyles(t)
>
local t, rec
>
try
>
set rec to t as record
>
set t to <<class ktxt>> of rec --###replace << and >> with real ones
>
end try
>
t
>
end RemoveStyles
Actually, Arthur Knapp, who was the first to discover the <<class ktxt>>
thing, if I'm not mistaken, also was to first to come up with a handler too:
on AsText(str)
--coerce Unicode or other text to styled string to plain text
try
return (((str as string) as record)'s <<class ktxt>>) -- real
end try
return str -- if plain text to begin with
end AsText
But I didn't have it to hand when I wrote yesterday.
--
Paul Berkowitz
_______________________________________________
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.