Unknown cause for -10004 error
But the Events and Replies pane shows it encountering a '-10004' error with each list item, "A privilege violation occurred."
After the error, the 'end tell' is executed, followed by a tell block that isn't in ScriptEditor.app which actually accomplishes the 'say' command. A typical unknown 'tell' block appears this way in the execution sequence:
tell application "Finder"
say "85"
--> error number -10004
end tell
tell current application
say "85"
end tell
tell application "Finder"
say "86"
--> error number -10004
… and so on.
This example simplifies a more useful Applescript which fails in the same way, but halts execution inside a 'try' block. Can someone tell me how to eliminate the -10004 error, so I can solve my other scripting problem?
==== Applescript that produces the -10004 error ====
set currentFolder to "My HD:Users:my veryown:Desktop:Testing folder"
set currentList to ""
set currentFile to ""
tell application "Finder" -- collect list of items in folder; ref: p. 137, Language Guide
set currentList to the name of every file of folder currentFolder
end tell
try
tell application "Finder"
repeat with n from 1 to the count of currentList
set currentFile to item n of currentList
say text 7 thru 8 of currentFile
end repeat
end tell
end try
MacBook Pro Core 2 Duo, late 2007 2.2 GHz, Mac OS X (10.6.7)