Someone on this list kindly provided a JS (below) which would place brackets or anything else around selected text.
I use braces for provisional text in the editing process,for example [renewable energy], and if the text is made final then the braces are removed.
Not all braces are removed in the same version so it is really difficult to do a find/replace. Also for some reason, when a word is double-clicked for selection, InDesign won't select the surrounding brackets (but it does select $ or £ signs) and it is really fiddly selecting a narrow little [ and then the ].
The JS I have to place braces is as follows:
var myObject = (app.selection.parent.constructor.name == "Cell") ? app.selection.parent.texts : app.selection;
insertionPoints[-1].contents = "]";
insertionPoints.contents = "[";
Can this be changed to deletion rather than insertion? Yes, I have tried changing it to deletionPoints, but this does not work.