• 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: Template for Debugging "on Open..." Handler
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Template for Debugging "on Open..." Handler


  • Subject: Re: Template for Debugging "on Open..." Handler
  • From: Michael Terry <email@hidden>
  • Date: Fri, 19 Mar 2004 22:56:16 -0800

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


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


Mike
_______________________________________________
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.


  • Follow-Ups:
    • Re: Template for Debugging "on Open..." Handler
      • From: Richard Morton <email@hidden>
References: 
 >Template for Debugging "on Open..." Handler (From: "Grimm, Kenneth" <email@hidden>)
 >Re: Template for Debugging "on Open..." Handler (From: Richard Morton <email@hidden>)
 >Re: Template for Debugging "on Open..." Handler (From: steve harley <email@hidden>)

  • Prev by Date: Re: osascript crashed and burned getting raw source of huge email attachments
  • Next by Date: Re: osascript crashed and burned getting raw source of huge email attachments
  • Previous by thread: Re: Template for Debugging "on Open..." Handler
  • Next by thread: Re: Template for Debugging "on Open..." Handler
  • Index(es):
    • Date
    • Thread