【问题标题】:Showing screen splash with Google App Script使用 Google App Script 显示屏幕启动画面
【发布时间】:2017-01-26 14:38:18
【问题描述】:

有人知道如何在 Google App Script 中显示屏幕启动画面吗?我想在检查电子表格的行时显示屏幕启动画面。谢谢。

【问题讨论】:

标签: google-apps-script google-sheets google-spreadsheet-api


【解决方案1】:

在脚本编辑器中将启动画面创建为 HTML 文件。在 File->New 下选择 Html 文件。调用文件 test_HTML 并将其放入文件中:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    Splash
  </body>
  <script>

  setTimeout(myFunction, 3000)

  function myFunction() {
    google.script.host.close();
  }
  </script>
</html>

在 Code.gs 中放置以下内容:

function onEdit(e){

  var splashScreen = HtmlService.createHtmlOutputFromFile('test_HTML')
        .setHeight(600)
        .setWidth(600);

  SpreadsheetApp.getUi()
      .showModalDialog(splashScreen, 'Dialog title');

}

在这种情况下,在编辑文档时,闪屏 HTML 将弹出并显示 3 秒。您必须修改它以使用您的代码,但应该为您提供使用 HTML 服务作为启动屏幕的基本原则。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-07
    • 1970-01-01
    • 2021-09-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多