有没有办法在 Applescript 的下一个框中显示用户输入(例如名称)?示例:你好,吉米
Is there a way to display the user input (E.g. Name) in the next box in Applescript? Example: Hello there, Jimmy
set userName to display dialog "What's your name?" default answer "Name" buttons {"Cancel", "OK"} default button 2
if the button returned of the result is "OK" then display dialog "Hi there, "
在最后说“你好”的地方,我希望它在之后说出用户输入。有办法吗?
这应该适合你……
我用 try 命令包装了代码。如果用户选择“取消”,这样做将允许您的 AppleScript 继续执行任何其他代码
try
set userName to text returned of (display dialog "What's your name?" default answer ¬
"Name" buttons {"Cancel", "OK"} default button 2)
display dialog "Hi there, " & userName
end try
set userName to display dialog "What's your name?" default answer "Name" buttons {"Cancel", "OK"} default button 2
if the button returned of the result is "OK" then display dialog "Hi there, "
在最后说“你好”的地方,我希望它在之后说出用户输入。有办法吗?
这应该适合你…… 我用 try 命令包装了代码。如果用户选择“取消”,这样做将允许您的 AppleScript 继续执行任何其他代码
try
set userName to text returned of (display dialog "What's your name?" default answer ¬
"Name" buttons {"Cancel", "OK"} default button 2)
display dialog "Hi there, " & userName
end try