banner



How Do I Make Draw A Box Around Existing Text In Google Docs Chrome

Scripts can extend certain Google products by adding user-interface elements that, when clicked, execute an Apps Script part. The nearly mutual example is running a script from a custom carte du jour item in Google Docs, Sheets, Slides, or Forms, but script functions tin can also be triggered by clicking on images and drawings in Google Sheets.

Apps Script tin can add new menus in Google Docs, Sheets, Slides, or Forms, with each menu detail tied to a role in a script. (In Google Forms, custom menus are visible simply to an editor who opens the form to modify it, not to a user who opens the course to respond.)

A script can but create a menu if it is leap to the document, spreadsheet, or form. To brandish the menu when the user opens a file, write the menu code within an onOpen() function.

The example beneath shows how to add together a menu with ane item, followed by a visual separator, and then a sub-menu that contains another item. (Note that in Google Sheets, unless you're using the new version, you must use the addMenu() syntax instead, and sub-menus are not possible.) When the user selects either menu item, a corresponding function opens an alert dialog. For more information on the types of dialogs you tin can open, see the guide to dialogs and sidebars.

          function onOpen() {   var ui = SpreadsheetApp.getUi();   // Or DocumentApp or FormApp.   ui.createMenu('Custom Menu')       .addItem('First detail', 'menuItem1')       .addSeparator()       .addSubMenu(ui.createMenu('Sub-menu')           .addItem('Second item', 'menuItem2'))       .addToUi(); }  function menuItem1() {   SpreadsheetApp.getUi() // Or DocumentApp or FormApp.      .alert('You clicked the kickoff card item!'); }  function menuItem2() {   SpreadsheetApp.getUi() // Or DocumentApp or FormApp.      .alert('You clicked the second card item!'); }                  

A certificate, spreadsheet, presentation, or form can but contain one menu with a given name. If the aforementioned script or another script adds a bill of fare with the same name, the new menu replaces the sometime. Menus cannot be removed while the file is open, although you can write your onOpen() function to skip the carte du jour in the future if a certain holding is prepare.

Clickable images and drawings in Google Sheets

You tin can also assign an Apps Script office to an image or cartoon in Google Sheets, then long as the script is bound to the spreadsheet. The example below shows how to set this up.

  1. In Google Sheets, select the menu particular Extensions > Apps Script to create a script that is bound to the spreadsheet.
  2. Delete whatsoever code in the script editor and paste in the code beneath.
    function showMessageBox() { Browser.msgBox('You clicked information technology!'); }
  3. Return to Sheets and insert an image or drawing by selecting Insert > Image or Insert > Drawing.
  4. Afterward inserting the image or drawing, click it. A minor drop-down card selector will announced in the top right-hand corner. Click it and choose Assign script.
  5. In the dialog box that appears, type the name of the Apps Script function that you want to run, without parentheses — in this case, showMessageBox. Click OK.
  6. Click the image or drawing again. The role will at present execute.

Yous can too assign an Apps Script role to a link in Google Sites, so long every bit the script is bound to the site. The case below shows how to set this upwardly.

  1. In a Google Site, click More > Manage site.
  2. In the sidebar, click Apps Scripts, then Add new script to create a script that is bound to the site.
  3. Delete any lawmaking in the script editor and paste in the code below, which will send an electronic mail when the user clicks a link.
    office sitesLink() { var recipient = Session.getActiveUser().getEmail(); GmailApp.sendEmail(recipient, 'Email from your site', 'You clicked a link!'); }
  4. Return to the Google Site and edit a folio. Blazon a label that will become a link, such equally Click me, and so highlight the text and select Insert > Link.
  5. In the dialog that appears, click Apps Script, then click the sitesLink function that you merely created. Click OK.
  6. Click Salvage at the elevation of the page.
  7. Click the link yous added to the page.
  8. A dialog box will announced and tell you that the script requires authorisation. Click OK. A second dialog box volition then asking authorization for specific Google services. Read the notice advisedly, then click Allow, and then Close.
  9. At present that the script is authorized, click the link you added to the folio again. The function will now execute. Bank check your e-mail to come across the email y'all sent yourself.

Source: https://developers.google.com/apps-script/guides/menus

Posted by: freemantherwas.blogspot.com

0 Response to "How Do I Make Draw A Box Around Existing Text In Google Docs Chrome"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel