Re: Coerce to 'alias list'
Re: Coerce to 'alias list'
- Subject: Re: Coerce to 'alias list'
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 20 Jan 2004 19:53:15 -0800
On 1/20/04 7:18 PM, "Walter Ian Kaye" <email@hidden> wrote:
>
At 07:17p -0700 01/20/2004, Michelle Steiner didst inscribe upon an
>
electronic papyrus:
>
>
> On Jan 20, 2004, at 6:02 PM, Walter Ian Kaye wrote:
>
>
>
>> When I do
>
>>
>
>> tell app "Finder"
>
>> selection as alias list
>
>> end tell
>
>>
>
>> I get a list of Finder references instead of a list of aliases, and
>
>> since there's no error, a try block is useless.
>
>
>
> That's because you're using "selection"; there is a bug that doesn't
>
> let you coerce the result of "selection" into an alias list. This
>
> works:
>
>
>
> set foo to (choose folder default location (path to desktop))
>
> tell application "Finder"
>
> try
>
> set bar to items of foo as alias list
>
> on error
>
> set bar to items of foo as alias
>
> end try
>
> end tell
>
>
But you're not using selection!
>
How would you get a list of aliases from a selection?
you can't - except by a repeat loop. I think that's because it has to be a
Finder reference (every item of some container), rather than selection -
which resolves to an AppleScript list. (OK, so does the 'every item'
reference, but I do know other apps where 'selection' presents a special
problem too.) You can't use it with selection. Now if only there was such as
thing as a 'selected' property, then you could say 'every item of desktop
whose selected is true'. But, alas, there's no such property.
--
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.