google-apps-script - 谷歌脚本 CardService.newButtonSet() 越来越空
问题描述
在附加到 Google 电子表格的脚本中,我有一个自定义菜单项来启动/停止脚本。有条件地存储在其他地方的实际状态我想更改提示窗口。一个问题是它似乎CardService.newButtonSet()
是空的,所以添加按钮会导致错误。
var state = true //Comes from DocumentProperties
var onButton = CardService.newTextButton().setText("Spustit")
var offButton = CardService.newTextButton().setText("Pozastavit")
var cancelButton = ui.Button.CANCEL
var buttonSet
if (state == "true"){
msg = "Do you want to stop the scripts?"
title = "Automatic update is on"
// Here I get the error: "Cannot find method addButton(Button)"
buttonSet = CardService.newButtonSet().addButton(offButton).addButton(cancelButton)
} else if (state == "false"){
msg = "Do you want allow the scripts"
title = "Automatic update is off"
buttonSet = CardService.newButtonSet().addButton(onButton).addButton(cancelButton)
} else {
msg = "Do you want to switch automation on or off?"
title = "Automation"
buttonSet = CardService.newButtonSet().addButton(onButton).addButton(offButton).addButton(cancelButton)
}
你有提示,有什么问题吗?
解决方案
来自https://developers.google.com/apps-script/reference/card-service/
目前您只能使用此服务来构建 Gmail 插件。
推荐阅读
- flutter - Flutter Bloc 消费者状态重叠
- postgresql - 单元测试 Postgres 数据库连接 golang
- django - drf-spectacular 找不到检查员课程
- tooltip - 格式化 Altair 等值线地图图例比例和工具提示
- python - MATLAB的PIQE函数错了吗?
- assembly - 如果我在 MIPS32 程序集中将其空间保留为 .space,是否需要以空值开头?
- google-bigquery - BigQuery,有没有办法在整个数据库中搜索字符串?
- linux - 将 ioremap 用于端口空间地址有什么好处吗?
- java - Spring Webflow - 广义决策状态的最佳实践
- javascript - 如何将种子值传递给 Sequelize 中的随机顺序函数