1

为什么这个简单的 Applescript 片段不起作用?

set x to 0
set thePath to "~/Pictures/party hard/b93-" + x + ".png"

我得到错误:

Can’t make "~/Pictures/party hard/b93-" into type number.

我已经尝试了很多其他的东西,比如(x as string).

它是如此简单,我不明白为什么它不起作用。

4

1 回答 1

5

AppleScript 的连接运算符是&, while+是按字面解释的。它会引发错误,因为您的代码正在尝试将字符串和数字相加。

试试这个:

set x to 0
set thePath to "~/Pictures/party hard/b93-" & x & ".png"
于 2013-01-20T12:27:40.900 回答