can';无法理解在applescript中分配变量时发生的错误

can';无法理解在applescript中分配变量时发生的错误,applescript,Applescript,我对applescript甚至这个社区都是新手,所以这个问题似乎很奇怪。如果是这样,我很抱歉。 但我在谷歌上找不到答案。所以让我问一下 当我运行代码时 tell application "Evernote" set theNote to item 1 of selection set theTitle to (title of theNote) end tell 我有个错误,上面写着 /var/folders/fm/k76y42cs1y98bjwfyf951q1r0000gn/

我对applescript甚至这个社区都是新手,所以这个问题似乎很奇怪。如果是这样,我很抱歉。 但我在谷歌上找不到答案。所以让我问一下

当我运行代码时

tell application "Evernote"
    set theNote to item 1 of selection
    set theTitle to (title of theNote)
end tell
我有个错误,上面写着

/var/folders/fm/k76y42cs1y98bjwfyf951q1r0000gn/T/vbkvTSQ/55:47:53: execution error: Evernote got an error: Can’t make item 1 of selection into type specifier. (-1700)
但如果我在下面跑

tell application "Evernote"
    set theNote to (selection)
    set theNote to item 1 of theNote
    set theTitle to (title of theNote)
end tell
我可以得到预期的结果


为什么会发生这种错误?我看不出两个代码的差异。

Applescript的隐含
get
再次罢工

尝试这样做:

tell application "Evernote"
    set theNote to item 1 of (get selection)
    set theTitle to (title of theNote)
end tell
Applescript的用意很好,但它隐藏了很多实现细节,这使得一些错误看起来比实际情况更随机。“隐含get命令”的缺陷,因此我将用一段引语进行总结

可能导致问题的一个原因是命令“get”。通常,当您运行像“name of me”这样的命令时,get命令是隐含的,因此您实际上是在运行“get name of me”。问题是隐含的“获取”并不总是如此。所以有时候你必须明确地说“得到”。每当我遇到像您这样的问题时,我尝试的第一件事就是在命令中添加“get”