how do I move the cursor to the end or beginning of a document using a google script?

I am fairly new to coding and I am making a script that will move the cursor to and from the end and beginning a a document whenever I type "start 534" or "end 534". My script looks like this:

if ('start 534') {

}

if ('end 534') {

}

as you can see, I don't have much.

Upvotes: 1

Views: 622

Answers (1)

Alan Wells
Alan Wells

Reputation: 31310

There is no way to do this. A Google Doc has no way to create an event listener for typing certain characters. The only event trigger available to a Doc is the onOpen event. You can't monitor for typing certain key strokes.

There are programs that will monitor your keyboard, and run a program from your operating system.

You can add a custom menu item, that would move to the end of the Doc, but you'd need to click on the custom menu, then choose a menu item from a list.

Upvotes: 1

Related Questions