File lists and indexer
File lists and indexer
- Subject: File lists and indexer
- From: "Eric Phillips" <email@hidden>
- Date: Wed, 15 May 2002 09:31:12 -0400
I am writing this to get a better understanding of why some things work the way they do in AppleScript. I have a script that generates a list of files from a folder, does abunch of stuff with each file then gets another list of files form another folder... Why can't I use the same variable to store each of the file lists. The sample below doesn't work. When I get the second file list it returns an empty list unless I use a different name. I am running OS 10.1.4 with AS 1.7
tell application "Finder"
set afilelist to every file of afolder
end tell
Do stuff with every file
Tell application "Finder"
set afilelist to every file of bfolder
end tell
This returns an empty afilelist. If I change the variable name for the second afilelist to bfilelist it works fine, Why?
The second question is about the repeat loops. When you write a repeat like:
repeat with i in afilelist
do stuff
end repeat
The 'repeat' statement defines the variable i. So I would think in a subsequent 'repeat' statement I could write the same thing and it would redefine the variable i but i stays defined as the last file in the previous repeat loop. So is there a way to reset i or do you need to use a different index say j for the second repeat loop?
Thanks for any insight,
Eric Phillips
_______________________________________________
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.