Yes/no 用户提示继续或停止脚本
Yes/no user prompt to continue or stop the script
我有这个不错的 google 应用程序脚本,它运行良好,但它导致我的 google 传播 sheet 中的 sheet 被删除,因此我想要脚本以询问 "Are you sure you want to close the job" 的 Yes/No 提示开始。如果他说是,很好,继续,如果不是,退出脚本。
有什么想法吗?提前致谢!
找到这个
// 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.');
}
我有这个不错的 google 应用程序脚本,它运行良好,但它导致我的 google 传播 sheet 中的 sheet 被删除,因此我想要脚本以询问 "Are you sure you want to close the job" 的 Yes/No 提示开始。如果他说是,很好,继续,如果不是,退出脚本。
有什么想法吗?提前致谢!
找到这个
// 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.');
}