• 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: Coercing document list to alias list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercing document list to alias list


  • Subject: Re: Coercing document list to alias list
  • From: Mahlon Lovett <email@hidden>
  • Date: Tue, 12 Dec 2006 12:13:39 -0500
  • Thread-topic: Coercing document list to alias list

Hmmmm... doesn't work for me

tell application "Finder"
    get the selection -- a selection of docs, images, whatever
    tell (result)
        if (count) = 1 then
            set the_list to {it as alias}
        else
            set the_list to it as alias list
        end if
    end tell
    --> return the_list
end tell

I still get a bunch of system file references rather than an alias list...

Mahlon Lovett
Princeton NJ


> From: <email@hidden>
> Reply-To: <email@hidden>
> Date: Mon, 11 Dec 2006 10:38:14 -0800 (PST)
> To: <email@hidden>
> Subject: AppleScript-Users Digest, Vol 3, Issue 627
>
> So anyway... in an attempt to workaround AppleScript's ham-
> handedness, the Finder dictionary defines its own custom 'alias list'
> type for use as the 'get' command's 'as' parameter. This somehow
> tricks AppleScript's normal coercion behaviour into letting the
> returned list of aliases through untouched. Except where it's a
> single-item list, which AS first coerces to a single item (since it
> always knows how to do that coercion), then tries to coerce to the
> 'alias list' type (which fails as 'alias list' isn't a type that AS
> knows itself). AS is just too damn clever for its own good sometimes.
> So users end up having to apply a further workaround to deal with
> that case, e.g.:
>
>      tell application "Finder"
>          tell some_reference
>              if (count) = 1 then
>                  set the_list to {it as alias}
>              else
>                  set the_list to it as alias list
>              end if
>          end tell
>      end tell

 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: rm does not always remove immediately
  • Next by Date: Re: rm does not always remove immediately
  • Previous by thread: Re: Coercing document list to alias list
  • Next by thread: Re: Coercing document list to alias list
  • Index(es):
    • Date
    • Thread