Re: Weird info for/choose file prompt issue
Re: Weird info for/choose file prompt issue
- Subject: Re: Weird info for/choose file prompt issue
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 06 Apr 2003 06:59:49 -0700
On 4/6/03 6:48 AM, "Brennan" <email@hidden> wrote:
>
On 06/04/2003 at 3:16 PM, I wrote:
>
>
> 4) (class of fname) always returns string
>
>
Oops! Not correct. class of (name of (info for (someFile))) is Unicode Text
>
>
BUT the problem remains, even if I coerce to string.
>
>
set p to "hello" as Unicode text
>
set pp to p as string
>
choose file with prompt pp
>
>
>
So, I've narrowed it down to the fact that 'choose file' does not accept
>
unicode for prompts, and that I don't (yet) know how to coerce unicode into
>
something that 'choose file' WILL accept.
'Choose file' needs _plain text_. What you get when you coerce Unicode text
'as string' is 'international text', a type of styled text. The following
uses a handler of Arthur Knapp's. The << and >> signs represent chevrons
made with option-\ and shift-option-\ on a US keyboard, because this absurd
mailing list will butcher them if I use them here.
set someFile to choose file with prompt "test one"
set inf to (info for someFile)
set fName to AsText(name of inf)
set prmpt to "Test Two " & fName
choose file with prompt prmpt
on AsText(str)
--corece Unicode or other text to styled string to plain text
try
return (((str as string) as record)'s <<class ktxt>>)
end try
return str -- if plain text to begin with
end AsText
--
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.