Can I add item to Google Docs right-click menu for my Add-on? - google-apps-script

I'm writing an add-on for Google Docs, using Google Apps Script and I see that I can add actions to the Add-ons menu using DocumentApp.getUi().createAddonMenu().addItem. My current action launches a sidebar. But that's several clicks away from the user. I'd like to put an option on the right click menu and / or make the action available via a hotkey.
Is there a way to add to the right click menu or create a hot key to launch my add-on item?

You could just launch your sidebar in the onOpen event for the spreadsheet and it will be there right from the start.

Related

Google Sheets script : Click on menu item

I'd like to have a script that simply clicks on File > Download > PDF of a Google Sheets menu.
To simplify, I first tried to have the script click on "File".
With devtools I could determine that this menu item has id="docs-file-menu" so my function should look like :
document.getElementById('docs-file-menu').click();
But it doesn't work because document is not defined.
While searching for a solution, I understood that Apps scripts cannot interact with the browser, but I'm not quite sure whether that includes the sheets menus items as well?
Is there any way to make a script click on a menu item?
If not possible, is there any other way to make the "download as pdf" window appear?

GOOGLE SLIDES: Prevent User From Moving To The Next Slide Using The Keyboard

I have a very simple presentation that I created using Google Slides and I published it as a website (Publish To The Web). The link is below.
What I want is to prevent the user from navigating the slides (moving to the next slide or previous slide) using the keyboard. I want to force him only to click on the Next Slide / Previous Slide buttons that I created on the slide.
Appreciate your help
https://docs.google.com/presentation/d/e/2PACX-1vQMQdpDXHl2rVIk6dkj8tEcTKYhcBOlW9v-TkCGuggutriEztCrEoI9c9Eazv4_hiufvKeGPa9A4zY4/pub?rm=minimal
Unfortunately, according to an answer from a similar post A Google script to disable keys in a keyboard, Google Apps Script can't disable keys in a keyboard nor includes any service to modify the key behavior in Google Slides or any other Google services.
I know i'm late but I'm pretty sure you just have to right click on the slide and click on skip slide.

How to show images on text hover in google docs addon

I am new to google docs Add-ons. I am working on an add-on in which I need to show set of image on text hover like tooltip in html
I did not find a way to implement this after hours of googling. please help.
This is not possible.
The above because the Documents Service of Google Apps Script doesn't include "on hover" event / trigger or something similar
The only way is by using a dialog or sidebar and they can only be launched by clicking on a custom menu or by using google.script.run on a previously opened dialog / sidebar.
References
https://developers.google.com/apps-script/guides/doc
https://developers.google.com/apps-script/guides/triggers
https://developers.google.com/apps-script/guides/dialogs
Related
Show Popup of YouTube video within Google Doc

Custom sidebar addon for Google Docs

I am trying to write a simple add-on for Google Docs. It basically a list of items I want to have visible on the side when I am using Docs. I followed this simple tutorial.
I don't want to publish such a simple add-on unnecessarily. Is there a way that I could use it just within my Google Docs without publishing it ?
If you've just copied the sample code into your document's script, it already works there. To activate the script you have to reopen the document, then in the menus at the top click Custom Menu -> Show sidebar.
You only have to publish a script if you want to share your add-on with other users.
If you still have problems, take a look at Add-on Quickstart. It describes add-on creation process in details.

How to share a google spreadsheet that contains google app script?

I followed the tutorial at google developer web site to create a spreadsheet. And as expected when I reloaded the spreadsheet, a menu called "Bracket Maker" is now available on the menu bar.
But if I share this document to my friends, they can open this document, see all the content in the document. But they just don't have the "Bracket Maker" menu bar. How should I do to make sure they also get the script capability?
The menu is created when the onOpen is triggered.
How are you creating the menu - using the onOpen function or an installed trigger ?
If you created it using an installable trigger, then your friends have to set up the trigger manually.