在 Applescript 中获取某些列表项

Getting certain list items in Applescript

所以我有一个小脚本应该在 applescript 中添加 list/array 的第一项和第二项。下面的代码可以正常编译,但不能 运行。它 returns 的错误如下: «script» doesn’t understand the “theArray” message. 它附带的错误消息是 -1708,根据 https://www.osstatus.com,这意味着 errAEEventNotHandled

set theArray to {1, 2}
set theSolution to theArray(1) + theArray(2)

theArray(1) 是错误的语法。要获取数组的一项,您必须编写 item 1 of theArrayfirst item of theArray

set theArray to {1, 2}
set theSolution to item 1 of theArray + item 2 of theArray