Google Apps Script google.script.run html не работает, скрипт не запущен - PullRequest
0 голосов
/ 30 марта 2020

Я очень надеюсь, что вы можете помочь мне с этим! Я не понимаю, почему мой html «скрипт» не хочет общаться с моим «кодом», как это было раньше.

Это история. Я создал небольшое приложение с помощью скрипта Google Apps. Я хотел передать это приложение другому пользователю Google, поэтому я поделился файлом, а затем сделал копию, чтобы я стал владельцем.

В это приложение у меня есть форма html, которая называется Пользователь нажимает кнопку, и текст кнопки будет перенесен в некоторые ячейки в Gsheet.

Таким образом, для первой учетной записи, из которой поступает приложение, оно все еще работает нормально. Для второго аккаунта это не так, и я не могу понять, почему. Это что-то связано с пользователем? Что-то не так в коде? Это связано с новым выпуском скрипта Apps на базе недавно выпущенного V8?

Пожалуйста, помогите мне, это очень важно для меня.

function NewshowDialog()
{
 var title = "Please Select STOP Reason";
     var uiDialog = HtmlService.createHtmlOutputFromFile('NewDialoghtml_ENG').setSandboxMode(HtmlService.SandboxMode.NATIVE);}
  uiDialog.setWidth(630);
  uiDialog.setHeight(330);
  return SpreadsheetApp.getUi().showModalDialog(uiDialog,title);
}

function msgbox_success()
{SpreadsheetApp.getUi().alert("Success");}

function msgbox_error()
{SpreadsheetApp.getUi().alert("Fail");}

function WriteInBreakName(breakname)
{ //write value in cells into the Gsheet}
<!DOCTYPE html>
<html>
  <head>
   <base target="_top">
    <script>
    function onSuccess() {
    google.script.run.msgbox_success();
    }
    
    function onFailure() {
    google.script.run.msgbox_error();
    }
    
      function myFunctionBreak_eng()
        {
          var breakname = document.getElementById("buttonBreak_eng").value;
            google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).WriteInBreakName(breakname);
          google.script.host.close();
        }
        
    window.closeDia = function()
        {
          google.script.host.close();
        };
    </script>
    
    <style>
    .BreakButton {
            box-shadow: 0px 1px 0px 0px #f0f7fa;
            background:linear-gradient(to bottom, #83d6f2 5%, #019ad2 100%);
            background-color:#83d6f2;
            border-radius:6px;
            border:1px solid #bcbcbc;
            display:inline-block;
            cursor:pointer;
            color:#222222;
            font-family:Arial;
            font-size:38px;
            font-weight:bold;
            padding:6px 24px;
            text-decoration:none;
            text-shadow:0px 1px 0px #cbe6ef;
            height:150px;
            width:200px;
        }
        .BreakButton:hover {
            background:linear-gradient(to bottom, #019ad2 5%, #83d6f2 100%);
            background-color:#019ad2;
        }
        .BreakButton:active {
            position:relative;
            top:4px;
        </style>
  </head>
  
  <body>
    <button class="BreakButton" type="button" id="buttonBreak_eng" value="Break" onclick="myFunctionBreak_eng()">Break</button>
   </body>
</html>
  
...