不允许从此上下文中调用Browser.inputBox() [英] It is not permitted to call Browser.inputBox() from this context

查看:53
本文介绍了不允许从此上下文中调用Browser.inputBox()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我第一次使用Google脚本时,我试图定义一个函数来调用Browser.input方法以获取用户名. 但我总是收到以下错误消息:

In my first experiences with Google Scripts, I'm trying to define a function that call a Browser.input method to get a user name. But I always get the following error message:

不允许从此上下文中调用Browser.inputBox().

It is not permitted to call Browser.inputBox() from this context.

(我必须说我是从葡萄牙语环境翻译过来的,因为在英语中情况有所不同).

(I must say that i've translated it from the portuguese environment, for the case there is a different expression for it in english).

如果有人可以建议我,我将不胜感激.谢谢.

I'd appreciate if someone could advise me. Thanks.

推荐答案

Browser.inputBox()仅可从电子表格中运行的脚本中使用.一旦使用Ui(通过UiApp或GUI构建器或HTML服务),就不能使用这些Browser方法. 只能将它们组合在一起的情况是,当您从电子表格脚本中show(app)进行操作时,然后Browser调用将立即关闭UI.

Browser.inputBox() can only be used from a script running from a spreadsheet. Once you use a Ui (with UiApp or GUI builder or HTML service) you can't use these Browser methods. The only situation in wich they can be combined is when you show(app) from a spreadsheet script but then the Browser call will close the UI immediately.

这似乎很合乎逻辑,因为它们本身就是Ui的一种方式...

This seems quite logical since they are in a way Ui themselves...

顺便说一句,您在评论中说您正在用一些代码更新您的问题,但是我什么也没看到?正常吗?

By the way, you say in your comment that you are updating your question with some code but I see nothing ? Is it normal ?

来回答您的评论,有很多与用户互动的方式... 弹出示例. 关于您的第二点:在哪里可以找到这些信息...好吧,我想我已经阅读了很长一段时间可以阅读的所有内容....我不确定该特定方面的描述, 对于那个很抱歉.如果您阅读了有关Ui的Google文档,我相信您会发现一些有关Ui的信息. (也许团队中有人可以帮助我吗?;-)

EDIT : to answer your comment, there are many ways to interact with users... something that is quite similar to Browser.message is the popup example proposed by Waqar Ahmad recently. As for your second point : where to find such information... well I guess I've read about everything that can be read on the subject for quite a moment now.... I'm not sure where that particular aspect is described, sorry about that. If you read Google documentation about Ui I'm pretty sure you'll find something about that. (maybe someone from the team could help me on that point ? ;-)

这篇关于不允许从此上下文中调用Browser.inputBox()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆