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
来获取按钮值,而不是短暂的结果。