String applescript-无法转换为类型编号

String applescript-无法转换为类型编号,string,numbers,applescript,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作为字符串) 它很简单,我不明白为什么它不起作用。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作为字符串)


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

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

试试这个:

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

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

试试这个:

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

非常感谢。我只是习惯了用其他语言编程,我已经有一段时间没用Applescript了。谢谢!我只是习惯了用其他语言编程,我已经有一段时间没用Applescript了。