Keyboard shortcuts in Google Slides Add-on - html

I'm creating an add-on for Google Slides. My add-on consists of a single button in HTML. Instead of having the user click on the button (which performs an action to the slide), is it possible to create a keyboard shortcut that automatically clicks the button or "calls" the script function?

Not really.
The add-on is in a separate iframe and doesn't have visibility to any keyboard events in the main window. It could capture events in the add-on window, but it only works if the focus is already on the add-on. The overhead of setting the focus properly makes the keyboard shortcut not so useful.

Related

What is the item limit for Google App Script Addon Gmail SelectionInput Class?

I'm using a Selection Input in a Gmail Addon that I create.
And I realize that I don't have a scroll bar, either the chance to move with my keyboard or an item limitation that is not specified in the documentation.

Use Google App Script to prevent user opening url link in Sheets if site is already open in another browser tab

I've got a Google Sheet that contains numerous hyperlinks.
I'd like to prevent the user from opening multiple instances of the same site.
ie. user clicks the hyperlink in one cell which opens the linked site in a new tab, then attempts to click the same hyperlink while the first new tab is still open - I'd like a dialogue box to appear saying that they cannot open this second new tab until they have closed the first one.
Is this possible via Google App Script?
Many thanks!
Unfortunately not. GAS has no access to your browser data and cannot know what tabs are open.Moreover, GAS has no way of intercepting hyperlink clicks from within a spreadsheet, it can only do that in a side bar, modal (or modeless) dialog, a custom or an add-on menu or an image with a script attached to it.

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

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.

Trigger event on chrome extension icon

It is possible to trigger a click event on chrome extension icon? Like in jquery we use to do:
$('#blabla').trigger('click');
My goal: if a certain element is visible in the popup, than trigger a click event on the icon. I'm aware of the chrome.browserAction, but for this I have to do a click manually.
No, it's not possible.
Chrome/Chromium considers the actual user interaction a very important factor to grant certain temporary privileges to the code executed in this interaction's event handler. Like the ability to access DOM of the active tab when only "activeTab" permission is specified in manifest.json. Or the ability to use clipboard API and some other things.

Chrome extension that runs in the background on window open event?

How can I make a Chrome extensions that is not a popup or a button?
I wanna have a script running whenever the window is opened and iterate thru all its tabs performing actions on each tab.
I also need (is this possible?) want to add to the same extension buttons (+keyboard shortcuts?) that when clicked, perform actions on all tabs.
Then I need control on these buttons visibility, and make them visible only in certain conditions (e.g. show only when page is loading, hide when not-loading).
Where do I put my script and how do I refer to it in my *.json manifest?
Any info/links will be appreciated.
The answers to 0 and 1 can directly be found in the documentation, specifically background pages, chrome.windows API and chrome.tabs API.
To bind global events, use the chrome.experimental.keybinding API. Because this API is experimental, you have to enable it first at chrome://flags. Also, the extension cannot be uploaded to the Chrome Web store.
If you want to add an "extension button" which performs some action on click, define a browser action and bind an event listener to chrome.browserAction.onClicked.
To select all tabs, use chrome.tabs.query({}, callback) method ({} means no filter, so all tabs are selected).
Browser action buttons are always visible. If you want to create a button which is not always visible, use a page action instead. The chrome.tabs module includes several events which can be used to find out whether your conditions are met.
As for putting up the script and the manifest file, read the documentation on Manifest files and explore some examples.