• 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: Wed, 13 Dec 2006 09:14:16 -0500
  • Thread-topic: Coercing document list to alias list

Here's where I'm puzzled:
  Select one item in a folder in the Finder and script #1 returns an alias;
select more than one item and it returns a list in the form {document file
of "" of folder "", ...} -- not an alias list.
  For my work, what this means is that, getting an alias list is easy if the
goal is operate on every item in a folder -- just use script #2. To operate
on a selection of items, it's necessary to use a repeat loop and build the
alias list 'by hand' -- i.e., the tedious way.

#1
tell application "Finder"
    set sel to the selection
    try
        set x to (every item of sel) as alias list
    on error
        set x to {(first item of sel) as alias}
    end try
end tell

#2 -- Yvan KOENIG
> tell application "Finder"
>   set TheFolder to choose folder
>   try
> set TheContent to (every file of TheFolder) as alias list
>   on error (*
> Here when the folder contains a single file *)
>   set TheContent to {(first file of TheFolder) as alias}
>   end try
> end tell

Mahlon Lovett
Princeton NJ

 _______________________________________________
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: iTunes doesn't handle dates well
  • Next by Date: Re: Problem with AppleScript
  • Previous by thread: Re: Coercing document list to alias list
  • Next by thread: Re: Coercing document list to alias list
  • Index(es):
    • Date
    • Thread