I have a Google doc which I regularly update and publish as a PDF. At the moment I have this script:
function onOpen()
{
var ui = DocumentApp.getUi () ;
ui.createMenu ('Automation')
.addItem ('Download Newsletter as PDF', 'DownloadNewsletterAsPDF')
.addToUI () ;
}
I want to (preferably) replace the nested menu item click with a big fat button, but I can't see how to do that, so my fallback is to create an empty menu and bind my function DownloadNewsletterAsPDF
to an OnClick
event, if such a thing exists. If I change the onOpen handler to this:
function onOpen()
{
var ui = DocumentApp.getUi () ;
ui.createMenu ('PDF')
.addItem ('.', 'Dummy')
.addToUi () ;
}
I can't have an empty menu so I need to provide a dummy item.
So how can I:
- add a clickable button to the editor UI
or
- generate an event when a menu header is clicked on.