需要帮助编写applescript中的按钮

时间:2019-07-18 17:04:10

标签: button applescript

我正在尝试在一个小程序的末尾添加一些按钮,以结束所有的事情。程序运行后,我需要3个按钮{“显示公式”,“返回列表”,“退出”}

我不知道自己在做什么,基本上,我在写这篇文章时经常在谷歌搜索,我想我需要帮助

buttons选项之后有一些代码,但它始终给我“结束”错误。我删除了代码,但忘记了必须显示yall

here's my code

set x to item 1 of (choose from list {"Divers consumption at depth", "Free gas volume", "Price list"})
if x is "Divers consumption at depth" then
    display dialog "what is divers breathing volume (default 1.4 l/min?" default answer "1.4"
    set varDvol to text returned of result
    display dialog "What is divers absolute depth pressure" default answer ""
    set varPbar to text returned of result
    set answer to varDvol * varPbar
    display dialog "Diver consumption is " & answer as text buttons {"See formula", "Return to list", "Exit"}

我希望按钮能像他们所说的那样。显示公式按钮将显示“消费=体积*压力”,如果需要执行其他功能,则返回列表将返回到原始列表,然后退出将退出应用程序

1 个答案:

答案 0 :(得分:0)

您正在寻找这样的结构:

display dialog "Diver consumption is " & answer as text buttons {"See formula", "Return to list", "Exit"}
set response to button returned of result
if response = "See formula" then
    #do one thing
else if response = "Return to list" then
    #do a different thing
else if response = "Exit" then
    #do a third thing
end if