repeat problem
repeat problem
- Subject: repeat problem
- From: Steve Suranie <email@hidden>
- Date: Tue, 25 Sep 2001 14:19:50 -0400
Hi folks:
Can anyone give me a hint as to why this is happening:
I am using a repeat statement to go through the contents of a folder and
determine the file type of the files in that folder. If they match a certain
type I want to do one thing, if not I want to ignore them. (For now I am
just moving the ones I want to do something to to another folder.
I have this script:
...set itemCount to count of every item of theFolder...
...repeat with i from 1 to itemCount
set itemName to name of item (i) of theFolder
set itemType to file type of item (i) of theFolder
if itemType = "EPSF" then
display dialog "This is an eps file"
move item (i) of theFolder to folder "LogoFolder" of folder
"MerionRecruitmentAds"
else if itemType = "TIFF" then
display dialog "This is a tif file"
move item (i) of theFolder to folder "LogoFolder" of folder
"MerionRecruitmentAds"
else
display dialog itemName
end if
end repeat...
this loops fine if I do something like this
...repeat with i from 1 to itemCount
set itemName to name of item (i) of theFolder
set itemType to file type of item (i) of theFolder
display dialog itemType
end repeat...
but if I throw in the if statement I get an error message stating it can't
get the last item of folder...blah, bah, blah.
Why won't the loop work with the if statement?
Muchos grandees
Steve