I have an Applescript (below) that I always used in OS 9. Now that I have OS X I want to run the same script. I opened it in the Script Editor and compiled but when I try to run the script I get an error, “Expected a reference.” This occurs at “repeat with j from 1 to the number of folders in masterFolder”. I don’t know what it means. The old editor had a Syntax checker that caught this kind of thing but nothing like that in OS X that I can find.
Is there a converter script or anything like that around? Do I have to start learnig AS from rock bottom (which is not far from where I am anyway)?
Thanks
tell application “Finder”
repeat
set masterFolder to choose folder
set Tester to name of masterFolder as text
if Tester contains “photo” then exit repeat
set thisDialog to display dialog “Folder name must contain ‘Photo’!”
end repeat
end tell
tell application “Finder”
with timeout of 500 seconds
repeat with j from 1 to the number of folders in masterFolder
set x to folder j of masterFolder
set folderName to characters 1 thru -1 of (name of x as text) – remove colon
repeat with i from 1 to the number of files in x
set oldFileName to name of file i of x
set newFilename to (folderName & “-” & oldFileName) as text
set the name of file i of x to newFilename
end repeat
end repeat
end timeout
display dialog " Done." buttons (“OK”) default button “OK”
end tell