It indeed isn’t too difficult. For your consideration, two scenarios:
1. To only put the text cursor at the very start of the text in a selected text frame:
try {
app.selection[0].texts[0].insertionPoints[0].select();
} catch (_)
{
/* beep beep */
}
2. To select all of the text in the frame:
try {
app.selection[0].texts[0].select();
} catch (_)
{
/* beep beep */
}
In both these scripts it is blindly assumed there is a selection, and it has at least one item (if you select multiple objects it will probably work at random, depending on what order you selected in!), and it contains some text. Now usually, for a more robust script, you would add some checking for each and every item that can possibly go wrong. It takes a lot of checking, not only because there are tons of different things to click on, but, surprisingly, users can also get incredibly creative at how to indicate what they want to do – click frame, click in frame, multiple selections, linked captions, not-a-textframe-at-all, et cetera.
But it’s a simple function to use, and you would not be surprised if you accidentally try it on an embedded image and nothing happens. (Rather than, say, an alert popping up stating that you cannot edit the text in that image, or – worse – an aggressive “boing” sound and a scary error message from ExtendScript with lots of technical details.
So here I wrapped the magic single line into a “try .. catch” sequence. This will bluntly run the script inside the “try” part and if something – *anything* – goes wrong, it will silently continue with the code in the “catch” part. Which … does nothing! There is just a comment there. So if nothing happens, it just means “yeah this ain’t gonna work and you probably should not have tried this”.
Pick one of these scripts (or both), save under a useful filename in your Scripts Panel, and make sure to assign a Keyboard Shortcut Key to it for maximum efficiency.
… Surprise! I assigned “Escape” with a context of “Default”, and lo! “Escape” toggles between having the text frame selected and having the text *in* it selected! I think that’s a keeper.