本文介绍了Google脚本:检查Browser.inputBox是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果Browser.inputBox弹出窗口没有值,如何终止脚本的运行.以下是应该在其中插入的代码(第07行)的一部分.我尝试使用 =="blank" ,但不起作用.我是编码新手.
How to end the script from running if Browser.inputBox pop-up window has no value. Below is part of the code (Line: 07) where this should go in. I tried using == "blank" but does not work.I'm novice in coding.
Google Spreadsheet
Google Spreadsheet
预先感谢!
// Below is to check Project Name.
if (ss.getSheetByName('Feedback').getRange('I1').isBlank()){
var prjName = Browser.inputBox ('ERROR!','Project Name is missing\\n\\nPlease Enter it below',Browser.Buttons.OK);
if (prjName == "cancel"){
Browser.msgBox('CANCELLED!', 'The feedback details have NOT been saved', Browser.Buttons.OK);
return;}
else if (prjName == "blank"){
Browser.msgBox('CANCELLED!', 'The feedback details have NOT been saved', Browser.Buttons.OK);
return;}
else
s1.getRange('I1').setValue(prjName);
}
推荐答案
这对我有用:
if (prjName == "" || prjName == "cancel"){
Browser.msgBox('CANCELLED!', 'The feedback details have NOT been saved',
Browser.Buttons.OK);
return;
}
这篇关于Google脚本:检查Browser.inputBox是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!