Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/wix/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Applescript 如何将变量设置为返回的文本?-苹果书_Applescript - Fatal编程技术网

Applescript 如何将变量设置为返回的文本?-苹果书

Applescript 如何将变量设置为返回的文本?-苹果书,applescript,Applescript,如何将变量设置为返回的文本 从以下位置返回的文本: display dialog "Type something" default answer "" buttons {"Done"} default button 1 之后自动编码: copy the result as list to {text_returned, button_pressed} 变量代码: set thing to text returned of the result 错误消息: 脚本错误 无法获取返回的{“完成”

如何将变量设置为返回的文本

从以下位置返回的文本:

display dialog "Type something" default answer "" buttons {"Done"} default button 1
之后自动编码:

copy the result as list to {text_returned, button_pressed}
变量代码:

set thing to text returned of the result
错误消息:

脚本错误

无法获取返回的{“完成”,“kjhfsdfhksh”}文本


我也试过其他类似的方法,但也没用。

你看起来很接近。这对我很有用:

display dialog "Foo?" default answer "Yes"
set theText to text returned of the result

如果您在显示对话框和访问结果之间执行任何操作,则可能无法再设置结果。

您似乎非常接近。这对我很有用:

display dialog "Foo?" default answer "Yes"
set theText to text returned of the result
如果您在显示对话框和访问结果之间执行任何操作,则可能无法再设置结果。

这就是我得到的结果:

display dialog "Password" default answer ""
set w to text returned of the result
if w = "Password" then
    display notification w
end if
这就是我得到的:

display dialog "Password" default answer ""
set w to text returned of the result
if w = "Password" then
    display notification w
end if

因此,我喜欢:
将结果设置为(显示对话框“Foo?”)
。或者有时
将结果设置为结果
。然后,我可以在获得文本值后继续使用
theResult
来获取按钮值,而不是短暂的
结果。因此,我喜欢:
将结果设置为(显示对话框“Foo?”)
。或者有时
将结果设置为结果
。然后,在获得文本值后,我可以继续使用
theResult
来获取按钮值,而不是短暂的
结果。