• 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: Tell Statement Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Statement Problem


  • Subject: Re: Tell Statement Problem
  • From: Matthew Smith <email@hidden>
  • Date: Sat, 28 Jan 2006 19:24:08 +1100
  • Thread-topic: Tell Statement Problem

on 28/01/2006 19:04, Bastard Child at email@hidden wrote:

> Hi All,
>
> I've got some code here that doesn't appear to be working, and I can't
> figure out why. The closest thing I can come up with, is that the
> "tell" statement doesn't like the "theFolder" variable. Whenever I run
> the code in the Script Editor, I draw the following error:
>
> Finder got an error: Expected a reference.
>
> Here's the code:
>
> -----
> set theFolder to choose folder
>
> parseFolder(theFolder)
>
> on parseFolder(aFolder)
> tell application "Finder"
> set theNumItems to number of items in aFolder
> end tell
> end parseFolder
> -----

aFolder is an alias which doesn't contain items.

You need to use a folder object. One way to do it is like this:

----
set theFolder to choose folder

parseFolder(theFolder)

on parseFolder(aFolder)
    tell application "Finder"
        set theNumItems to number of items in folder (aFolder as Unicode
text)
    end tell
end parseFolder
----

Although there may be a better way.

--
Matthew Smith


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Tell Statement Problem (From: Bastard Child <email@hidden>)

  • Prev by Date: Tell Statement Problem
  • Next by Date: Re: Tell Statement Problem
  • Previous by thread: Tell Statement Problem
  • Next by thread: Re: Tell Statement Problem
  • Index(es):
    • Date
    • Thread