• 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: Rogue list?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rogue list?


  • Subject: Re: Rogue list?
  • From: Chris Espinosa <email@hidden>
  • Date: Mon, 7 May 2001 11:18:11 -0700

I'm running AS1.6 under 9.1. When I run the following:

tell application "Finder"
set myPath to path to me
set myFolder to container of myPath
set theClients to name of folders of myFolder
end tell
log class of theClients
--if theClients = {} then set theClients to {}
set end of theClients to "New"
theClients

I get an error that I "Can't set end of {} to "New"." But when I uncomment
the line before, it works. Any explanations?

Yes, a simple one.

When the Finder returns an empty value collective Get Data operation (anything with a plural anywhere in the direct object, such as your "name of folders of myFolder"), it doesn't return an empty list, it returns an empty *record*. Which looks and prints and smells like an empty list, and compares correctly to an empty list, but can't do list-like things, like having its end set. Your commented-out line is unfortunately the correct workaround, as there's no way to specify an empty record in AppleScript itself.

Chris


  • Follow-Ups:
    • Re: Rogue list?
      • From: Paul Berkowitz <email@hidden>
    • Re: Rogue list?
      • From: Paul Berkowitz <email@hidden>
    • Re: Rogue list?
      • From: Emmanuel <email@hidden>
  • Prev by Date: Returns in Extracted Text
  • Next by Date: RE: Returns in Extracted Text
  • Previous by thread: Re: Rogue list?
  • Next by thread: Re: Rogue list?
  • Index(es):
    • Date
    • Thread