Re: Files of folder returns 0 ...
Re: Files of folder returns 0 ...
- Subject: Re: Files of folder returns 0 ...
- From: email@hidden
- Date: Wed, 6 Feb 2002 19:09:12 -0500
On Wed, 06 Feb 2002 18:10:32 +1100, Timothy Bates <email@hidden> asked,
>
Can anyone enlighten me as to why (inside a finder tell block)
>
>
When I have a folder with some files in it and
>
>
count every file of folder "amygdala:Pictures:needfixing:"
>
>
Correctly returns 156
>
>
Nevertheless a repeat loop dies on count 0
>
>
For instance
>
>
repeat with x in files of alias "amygdala:Pictures:needfixing:"
>
-->stops immediately
>
>
The event log shows that the count returns 0
This structure works as you would like in AS 1.5.5 under OS 9.1. At least on my
machine, which has both Jon's Commands and Akua Sweets. I mention this because
there may be a hidden alias-to-something else coercion happening.
I speculate what might be happening is that under your system, the alias isn't
being coerced into a Finder object. In that case, 'count every file of alias
"..." ' is seen as a 'every [class] of [list]'. So 'alias "..."' is coerced
into a single-element list {alias "..." }, and then AppleScript looks for item
of class 'file' in it. There aren't any, so you get 0 when you count them.
The test for this might be to try explicitly coercing the alias into a Finder
folder object.
tell application "Finder"
set fixing to folder (alias "amygdala:Pictures:needfixing:")
repeat with x in files of fixing
[...]
If that works, the I'd conclude the Finder isn't correctly coercing the alias
into a folder object, and so it isn't counting.
>
repeat with x in files of folder "amygdala:Pictures:needfixing:" also dies
>
immediately.
This form may be dependent on a Jon's Commands or Akua Sweets coercion to
convert the string into an alias.
The final test may be to use a long-winded genealogical Finder reference to the
folder:
tell application "Finder"
repeat with x in files of folder "needfixing" of folder "Pictures" of
disk "amygdala"
[...]
>
Is this a 1.8.2b2 bug, an X bug, or am I missing something?
Since it works in 1.5.5, its probably a bug, although it might be the effect of
some scripting addition. Whether its a 1.8.2b2 bug or an X bug, I don't know.
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden
_______________________________________________
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.