I am trying to get an applescript to work, but I keep getting the following error.
2012-12-24 03:09:04.733 hazelworker[2533] AppleScript error: {
OSAScriptErrorNumberKey = "-1708"
The script works fine on its own (e.g. if I provide the input folder via prompt). But when I plug that into hazel, even a trimmed down script seems to fail. I was able to get a somewhat similar script to work with files as input from hazel. But with folders as input, I have been unable to get it to run.
Following is my (trimmed down) script. This seems to work fine if I switch it to embedded script form. Any suggestions on what I might be doing wrong?
- Code: Select all
on hazelMatchFile(theFile)
set theFolder to theFile
try
tell application "Finder"
-- Iterate over every file within the folder
set filesToProcess to every file of theFolder
repeat with eachFile in filesToProcess
-- my processing goes here (but the script fails even without this content)
end repeat
end tell
return true
on error errorMessage
log errorMessage
return false
end try
end hazelMatchFile
Does hazel pass folder aliases to the script via theFile?
Also, my preference would be to avoid the applescript altogether and just use hazel; however, I need to make sure that hazel operates on my files in a specific order (e.g. by name). As an example, if I have 100 files in a folder, I need hazel to operate on A.XYZ followed by B.XYZ, C.XYZ and so on. However, hazel seems to pick up the files in an arbitrary sequence. Is there a way to achieve a strict order through hazel?
Either of these approaches would get me going (i.e. getting the applescript to work or having hazel operate in a specific order on the files).
Thanks in advance