Re: Tell Statement Problem
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