Insert cursor and bring up keyboard after action is run

Hi,

I’m pretty new to writing my own actions and wondered if anyone can help. I have written a few very simple actions to create new drafts with a tag and the date or time for example. When they run they work as required except that I need to press inside the new draft to bring up the keyboard and move the cursor to the correct insertion point. How can I automate this?

Thanks

There are script functions on the editor object to set cursor position and focus the editor. You would need something like the below at the end of your action:

editor.setSelectedRange(0, 0)
editor.activate()

setSelectedRange takes the index of the first character where you want the selection to begin, and the length of the selection (0 for none, just placing the cursor)

Hope this helps!

Amazing! Thank you so much for this and for all your work on the app.