applescript - 无法生成类型编号

时间:2013-01-20 12:21:47

标签: string numbers applescript

为什么这个简单的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)

这很简单,我不明白为什么它不起作用。

1 个答案:

答案 0 :(得分:4)

AppleScript的连接运算符为&,而+按字面解释。它会抛出错误,因为您的代码试图将字符串和数字一起添加。

试试这个:

set x to 0
set thePath to "~/Pictures/party hard/b93-" & x & ".png"
相关问题