I'm jealous that your add-on is working. I think I'm running into the same issue with a new add-on that was going through the review process this week. When I test the add-on from my script, it functions properly; however, during review, I was informed that after install, the add-on doesn't load.
I'm not sure what happened, but the add-on was somehow published today with this error, and it doesn't even open the menu after installing:
Parts of Speech add-on.
I'm a novice with all of this - mostly working in trial and error off a script from another add-on someone else helped me publish. When I Run the OnOpen and OnInstall functions in the script, the following error comes in the highlighted line below: Cannot call DocumentApp.getUi() from this context. (line 12, file "PartsofSpeech")
function onOpen(e) {
// DocumentApp.getUi().createMenu("Parts of Speech")
// .addItem('Open Toolbar', 'showSidebar')
// .addToUi();
DocumentApp.getUi().createAddonMenu().addItem('Open Toolbar', 'showSidebar').addItem('About', 'showAbout').addToUi();
}
Debugging the OnOpen function points to the same line of code; however, debugging the OnInstall function points to the above line of code as well as the one highlighted below:
function onInstall(e) {
onOpen(e);
}
If anyone has any ideas about this, I would greatly appreciate hearing them. Also...if you want to look at any other lines of code that may be creating the error, just let me know.
Thanks in advance for any assistance and for patience with my limited knowledge. :)