Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oshliaer/9422ade231c007c7a9149fed3fa13419 to your computer and use it in GitHub Desktop.
Save oshliaer/9422ade231c007c7a9149fed3fa13419 to your computer and use it in GitHub Desktop.
function onOpen(){
FormApp.getUi().createMenu("Моё меню")
.addItem("Добавить текстовое поле", "addTextField")
.addItem("Об этой Форме", "aboutForm")
.addToUi();
}
function addTextField(){
var textField = FormApp.getActiveForm().addTextItem();
textField.setTitle("Новое текстовое поле");
textField.setHelpText("Дополнительный текст");
}
function aboutForm(){
var dic = [
{
"title": "Это тест",
"cmd": "isQuiz",
"val": undefined
},
{
"title": "Принимает ответы",
"cmd": "isAcceptingResponses",
"val": undefined
},
{
"title": "Сводка ответов опубликована",
"cmd": "isPublishingSummary",
"val": undefined
}
];
var message = "";
var form = FormApp.getActiveForm();
for(var i = 0; i < dic.length; i++){
message += dic[i].title + ": " + form[dic[i].cmd]() + "\n";
}
FormApp.getUi().alert(message);
}
function onOpen(){
SpreadsheetApp.getUi().createMenu("Моё меню")
.addItem("Добавить новый лист", "addNewSheet")
.addToUi();
}
function addNewSheet(){
SpreadsheetApp.getActive().insertSheet();
}
function onOpen(){
DocumentApp.getUi().createMenu("Моё меню")
.addItem("Добавить новый абзац", "addNewParagraph")
.addToUi();
}
function addNewParagraph(){
DocumentApp.getActiveDocument().getBody().appendParagraph("Новый абзац");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment