Re: Template for Debugging "on Open..." Handler
Re: Template for Debugging "on Open..." Handler
- Subject: Re: Template for Debugging "on Open..." Handler
- From: Richard Morton <email@hidden>
- Date: Sat, 20 Mar 2004 18:55:37 +1100
On 20 Mar 2004, at 5:56 PM, Michael Terry wrote:
On Mar 19, 2004, at 5:57 PM, steve harley wrote:
set fileList to choose file with multiple selections allowed
if class of fileList is not list then set fileList to fileList as
list -- in case of single selection
my experience is that "with multiple selections allowed" guarantees
that the result is a list
I didn't realise Steve had sent this to the list so I replied privately
- the above is correct. It's only without the 'multiple selections'
bool that it returns a single alias, which makes sense. That means the
code I posted need only be:
on run
set fileList to choose file with multiple selections allowed
open fileList
end
Or even:
open (choose file with multiple selections allowed)
As far as I know, the result of 'choose from list' is always a list
except when it's not. But it's only not when the user picks the cancel
button, in which case it's false. In any case, because coercing a list
to a list doesn't do anything, that allows a more elegant method for
guaranteeing a list:
repeat with i in ((choose from list {1, 2, 3}) as list)
if i's contents is false then error "User canceled." number -128
-- do some stuff with list items
end repeat
We were actually talking about 'choose file' but it looks good. :)
Cheers,
Sing L File
_______________________________________________
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.