How can I get current caret position (Google document)? - google-drive-api

I'm working with google documents via google drive and google docs APIs (using C#)
The document is opened in <iframe> element for user to work with it
When the user clicks a button, some text should be inserted at the current caret (text cursor) position
How can I get value of current caret location index to insert text there?

Related

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.

Google Apps Script to force open the document outline

I'm sending a google doc (view only) out to a bunch of students. I would like the document outline to show by default. I know they can manually go in to the View menu and open the document outline, but is there any way to force open the document outline when students access the document (apps script?)

Google maps and Selenium IDE selection

I'm new in automatic testing and Selenium. I have problem with selection in google maps. I open list with word but couldn't find way to select http://prntscr.com/4elckp . Browser is Firefox.
you can try the record button which will record your test case. click on the red button at the top right corner and go to the google maps page and do whatever activity you wanted to do, make sure that no extra activity is recorded, else exclude it.
for example: if you type the minimise button, this too will be recorded so once your test case has been recorded, just remove the extra command on it

google app script documentation clear formatting api

I would like to write a google app script to automatically clear the default text formatting of my uploaded/converted google text documents. When editing a google document in google drive, this can be done manually by selecting the text and clicking the the "Format\Clear formatting" drop-down menu item.
I am wondering if there exists such google app api or apis or any other suggestions for doing this programmatically?
Google Apps Script can't run on document upload. So you can't do this without having to install script on every document. And it takes longer than just pressing Ctrl+A and clicking the clear formatting button.

How does google spreadsheet copy to clipboard?

I've been reading several articles saying it was not possible to copy from html5 to clipboard. Yet, I can see that it works perfectly fine from a google spreadsheet. How do they do it? Is there really a flash object under the hood?
The google uses a very simple but cool method. By using firebug you will get to know that the html code which is loaded has a text area in begining of size 1. What google doc does is that when user selects text and presses ctrl+c, it captures the event and by some technique gets the text which is selected in the doc container and sets the value of text area to that content. Than it focuses and selects the text area. Now it releases the ctrl+c event. But now the text is selected in text area so when the event is realeased the browser copies the text in text area and thus we get the copied text