對 Google 應用程式使用者介面環境中顯示的 prompt 對話方塊的回應。回應包含使用者在對話方塊輸入欄位中輸入的任何文字,並指出使用者點選哪個按鈕來關閉對話方塊。
// Display a dialog box with a title, message, input field, and "Yes" and "No"// buttons. The user can also close the dialog by clicking the close button in// its title bar.constui=DocumentApp.getUi();constresponse=ui.prompt('Getting to know you','May I know your name?',ui.ButtonSet.YES_NO,);// Process the user's response.if(response.getSelectedButton()===ui.Button.YES){Logger.log('The user\'s name is %s.',response.getResponseText());}elseif(response.getSelectedButton()===ui.Button.NO){Logger.log('The user didn\'t want to provide a name.');}else{Logger.log('The user clicked the close button in the dialog\'s title bar.');}
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003e\u003ccode\u003ePromptResponse\u003c/code\u003e objects store user input and button selections from prompts in Google Apps Script UI.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetResponseText()\u003c/code\u003e retrieves the text entered by the user in the prompt's input field.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetSelectedButton()\u003c/code\u003e identifies which button the user clicked to close the prompt (e.g., YES, NO, CLOSE).\u003c/p\u003e\n"],["\u003cp\u003eThis data allows scripts to react differently based on user interaction with the prompt dialog.\u003c/p\u003e\n"]]],[],null,[]]