NSAppleScriptErrorNumber = -1708

时间:2010-10-21 04:50:42

标签: objective-c applescript

我正在尝试使用Applescript将图像附加到邮件应用程序。但是在10.5我得到了

NSAppleScriptErrorNumber = -1708错误。这个错误是什么意思?

有人可以指导我吗?

此致 Sowmya

2 个答案:

答案 0 :(得分:0)

我写了一个AppleScript,告诉你错误代码是什么意思。得到它here。在帖子#9中查看我发布的最新版本。

答案 1 :(得分:0)

正如Philip Regan所说。需要更多信息。

但我怀疑它是你构建文件路径的。 我过去曾使用NSAppleScript将文件附加到邮件中。如果我没记错的话。我的应用程序将文件路径收集为Unix类型的路径字符串。 即/Users/UserName/Documents/myFile.ext。

在NSApplescript脚本字符串中,我使用“POSIX file \”%@ \“)作为别名”

NSString *scriptString= [NSString stringWithFormat:@"set theMailname to (POSIX file \"%@\") as alias\ntell application \"Mail\"\nset newMessage to make new outgoing message with properties{visible:true,subject:\"%@\", content:\"%@\"}\ntell newMessage\nset visible to false\n\nmake new to recipient at end of to recipients with properties {address:\"%@\"}\n  set theAddressFrom to \"%@\"\ntell content\nmake new attachment with properties {file name:theMailname} at after the last paragraph\nend tell\n save \nend tell\nend tell",fileStore,subject,body,theAddressTo,theAddressFrom];

fileStore 是转换为别名的文件的unix类型路径。