button - 在applescript中需要帮助编程按钮
问题描述
我试图在一个小程序的末尾添加一些按钮,当所有的事情都说完后,这将结束 uo 非常广泛。一旦程序运行,我想要 3 个按钮 {“显示公式”、“返回列表”、“退出”}
我不知道我在做什么哈哈,我在写这篇文章时基本上一直在谷歌搜索,我想我需要帮助
在按钮选项之后我有一些代码,但它一直给我“结束”错误。我删除了代码,我忘记了我必须向你们展示
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"}
我想要他们所说的按钮。显示公式按钮将显示“消耗=体积*压力”,如果需要执行另一个功能,返回列表将返回原始列表,退出将退出应用程序
解决方案
您正在寻找这样的结构:
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
推荐阅读
- python - 无法使用 pip 安装 mysqlclient(Ubuntu 18.04 LTS)
- c# - 添加 USB 存储 Oculus GO Unity C# 的读取权限
- javascript - 仅执行特定窗口大小的代码,无需重新加载页面 jQuery 或 javascript
- powershell - 根据文件的最新修改日期检索文件的内容
- yarnpkg - 纱线热重装不是热重装
- java - 如何迭代字符串以多次提取和存储特定内容
- javascript - 如何在 CKEditor 4 中设置默认字体?
- html - CSS:在标题上包装背景颜色
- r - 所有以“CPA”R 开头的列中的 Reaplce_na
- java - 具有不同主类文件(kotlin、kotlin dsl)的项目中示例的 Gradle 任务