Relatively simple sequential task. Help please!

Hi

I’m trying to get finder to open a file within a folder, then execute a script on that item, and repeat for all other items within the folder…

so far i have:

tell application “Finder”
set NoOfFiles to count of (files in folder “FolderLocation”)
return NoOfFiles
repeat with i from 1 to NoOfFiles
open item i using application “BBEdit”

                         --this is where i want the script ive made to go

     end repeat

end tell

i’m guessing my open command is not right - but hopefully you’ll get the gist of what im trying to do…

Thanks!

Hi,

two major problems:
return aborts the script!
item i has no reference (it should be item i of files in folder “FolderLocation”)

btw: BBEdit can open files without the support of the Finder :wink:


tell application "Finder" to set NoOfFiles to files in folder "FolderLocation"

repeat with oneItem in NoOfFiles
	tell application "BBEdit" to open oneItem as alias
	--this is where i want the script ive made to go
	
end repeat

Thanks Stefan works great!

apolgies for the ‘return NoOfFiles’ command in my example - a copy & pasting error!