Confusion with lists
Confusion with lists
- Subject: Confusion with lists
- From: Mark Dawson <email@hidden>
- Date: Sat, 6 Dec 2003 13:09:09 -0800
I'm confused on how to build lists in AppleScript. I have the
following code:
repeat with loop in Alist
if kind of (contents of loop) is "folder" then
set Blist to (every file of loop)
else
if ((count of Blist) = 0) then
set Blist to loop as list
else
copy loop to the end of Blist
end if
end if
end repeat
display dialog "Done with loop: " & (count of Blist)
-- Now have list of files that we can work off of
repeat with theItem in Blist
try
set extensionName to name extension of theItem
If I drop a folder that contains two files in it, my list count is 2,
which also happens if drop those 2 files directly on the script (note:
I know the above code doesn't handle groups of folders dropped on it,
nor recursive levels of folders, but that's OK for now)
However, when I try to operate on the list, I run into problems with
the list generated from the folder (every file of loop). I get an
error "can't get name extension of document file "xxx.ext" of folder
"leve1" of folder (directory list). No error occurs from the list
built from the dropped files.
I can't do a "kind of theItem" either (similar error).
I've obviously created two different types of lists of files. However,
I'm not sure why they are not the same or how to make them the same.
Would someone educate me?
Thanks!
Mark
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.