Google Docs: Catching keyup events - google-apps-script

I want to implement a custom autocomplete for google docs.
Therefore I would need to access any kind of text-input events within the document.
Are there any ideas how this could be done with App Scripts?

Google Docs doesn't have the onEdit() or onChange() event available to it.
https://developers.google.com/apps-script/guides/triggers/#available_types_of_triggers
I doubt that what you want is possible.
Inside of HTML, you can watch for a key event. But that would only be inside of a Dialog Box created with HTML, or a Sidebar with HTML.

Related

Is there a way to call myFunction() from an image, button, or link within a Google Doc, rather than using the menu?

I know that in Google Spreadsheets, you can bind a custom script function to the click event of an image, at least manually via the UI.
But in Google Docs, there doesn't seem to be any equivalent functionality. The only options are timers, onOpen() and ilk, and creating a menu item at the top.
Am I missing a way of adding a function launcher somewhere on the doc itself, especially dynamically from a script? I've searched a bunch and pored over the API docs, but I'm not seeing it.

Google Chrome extension - integrate with Google Calendar

How can a Chrome extension alter the Google Calendar event editing UI?
I see that, for example, the Moxtra extension has managed to inject UI including a button just below the location. According to their YouTube video they added a button to fill out the event description although when I installed Moxtra this no longer seems to work.
Stepping back from this a bit, it occurs to me that editing the Google Calendar page seems like something that could easily get messed up by future changes to Google Calendar. Perhaps it is better to edit the event description from the extension's own UI? If so, how can that be done?
Thanks.
It can be done with content scripts and modification of the DOM.
They probably check Event edit page for specific selectors and try to insert their own elements in the page, if they found it.
So, if UI of Google Calendar will change, extensions like Moxtra will be probably also broken.
You are right about the edit of the description - it's safer. But you still need to get a description field and change a content of it. There is no 100% safe way to do it and don't break on the change of UI.

Is it possible to place a button on a google calendar?

I know it can be done on a spreadsheet, like this, but is it possible to place a button on a google calendar? If not, do you know of something similar that might work?
It's possible to inject code HTML code in the description of an event, yet a button in the UI of a google calendar, no
https://developers.google.com/apps-script/reference/calendar/calendar-app#createeventtitle-starttime-endtime-options
in the attribute options you'll find the description

Can I add a Google Hangouts call to a Google Sheet?

I was wondering if it is possible to create a script in Google Sheets to launch a Google Hangout that calls me, preferably by phone but it could also run a video call to my Google+ account.
I currently know how to create a drawing, create a basic function, and assign the script to the drawing to make a button. Just wondering if there is a script out there for this or if it would be possible.
Essentially, I'm trying to add a "Call tech support" button to a complicated spreadsheet.
Thanks in advance!
The best I was able to do was create a button that opens a dialog that shows a "Start a Hangout" button. You can then click that button to open a Hangout window. There may be a way to embed a Hangout window into the dialog directly, but from what I've read, there are restrictions on spreadsheets that prevent some javascript functionality. Here is the code I used:
Code.gs:
function HangoutButton() {
var html = HtmlService.createHtmlOutputFromFile('HangoutButton').setSandboxMode(HtmlService.SandboxMode.IFRAME);
SpreadsheetApp.getUi().showModalDialog(html, 'Loading Hangout Button ...');
}
HangoutButton.html:
<script src="https://apis.google.com/js/platform.js" async defer></script>
<div class="g-hangout" data-render="createhangout"></div>
Here is a link to my working example (it may ask for you to give it permission). It has a button that I have linked to run the HangoutButton() method provided above.

disable dismiss hyperlink and message on google spreadsheet

When we run any method of Google App Script,a message appears on Google Spreadsheet with dismiss hyperlink.
For Example:
Running Script methodname Dismiss hyperlink
I would like to know if there is any option to disable the message and dismiss hyperlink that appears on Google Spreadsheet when any function is executed at the back ground. In not , please share what alternates are available to hide this out.
It is within a div of class docs-butterbar-container so on your own machine, you could add
.docs-butterbar-container {
display:none;
}
to a user stylesheet.
But if you are hoping to hide it from other others of your sheets/scripts then your likely out of luck, unless you have means of rolling out user stylesheets.
I also wouldn't recommend hiding this. It's useful.