为什么这个简单的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)
。
这很简单,我不明白为什么它不起作用。
答案 0 :(得分:4)
AppleScript的连接运算符为&
,而+
按字面解释。它会抛出错误,因为您的代码试图将字符串和数字一起添加。
试试这个:
set x to 0
set thePath to "~/Pictures/party hard/b93-" & x & ".png"