【发布时间】:2017-08-25 10:16:52
【问题描述】:
我有一个很好的谷歌应用程序脚本,它工作正常,但它会导致删除我的谷歌电子表格中的工作表,因此我希望脚本以是/否提示开始,询问“你确定要关闭工作”。如果他说是,很好,继续,如果不是,退出脚本。
有什么想法吗?提前致谢!
【问题讨论】:
标签: google-apps
我有一个很好的谷歌应用程序脚本,它工作正常,但它会导致删除我的谷歌电子表格中的工作表,因此我希望脚本以是/否提示开始,询问“你确定要关闭工作”。如果他说是,很好,继续,如果不是,退出脚本。
有什么想法吗?提前致谢!
【问题讨论】:
标签: google-apps
找到这个
// Display a dialog box with a message and "Yes" and "No" buttons. The user
can also close the
// dialog by clicking the close button in its title bar.
var ui = SpreadsheetApp.getUi();
var response = ui.alert('Are you sure you want to continue?',
ui.ButtonSet.YES_NO);
// Process the user's response.
if (response == ui.Button.YES) {
Logger.log('The user clicked "Yes."');
} else {
Logger.log('The user clicked "No" or the close button in the dialog\'s
title bar.');
}
【讨论】: