What are error -10004 and error -10000 in Applescript

家住魔仙堡 提交于 2019-12-04 13:01:39

Errors -10000 - -10015 are event registry errors.

Error -10000 is not a target error per se, because it will throw an -1708 in those cases mostly. most of the time it is not a target error but an incomplete command or wrong usage of brackets. What if you use:

save theDocument in file export_filename

Error -10004 is a privilege violation error, which mean you're doing something with the file that isn't allowed. Probably you're not allowed to remove the file and do shell script command should always be used outside tell application blocks. The problem is that the target application can run as another user than the script. I'm not saying it is the error but there is a chance that it this is the problem. Otherwise you simply heve not enough privileges and you need to ask the user for administrator privileges.

do shell script "do something" with administrator privileges.

I haven't found where those error codes are documented, but they mainly deal with events that the targeted application isn't able to do. The first two errors -10004 are from using a Standard Additions command inside an application tell statement (offset and do shell script) - the application doesn't know what those commands are, passes the error up the chain to AppleScript, but AppleScript knows what they are and does it.

I don't have OmniGraffle, but the last error is telling you that the save command couldn't be performed, probably due to a problem with the destination not being a file specifier - it is just a text string, so you will probably have to coerce it into something that the command wants.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!