Access the writer search string in the search box from macro?

In writer (& other modules) one can set up a search string by Ctrl-F (or, of course, Edit-Find) and repeat the search using Shift-Ctrl-F. one can also repeat the search forwards and backwards by using the arrows next to the search box. It would be useful to search backwards with a keystroke as well, but there does not appear to be a ‘Repeat Search Backwards’ command available. I therefore intended to write a macro to do so, but fell at the first hurdle - how does one access the search string which is entered in the search box?

In fact, for the reverse search (to search for the previous one) you can use the same key combination Shift+Ctrl+F. The search will be carried out in the same direction as you indicated by pressing the arrow on the search toolbar - up or down.

If you still want to use the macro, then I don’t recommend reaching out to the search engines that the application uses, this is fraught with errors in the work of the office suite. Better create your own search descriptor and use it.

Thanks, JohnSun. Fair comment. I know that repeat search keeps going in the same direction, but I don’t like switching between keystrokes and clicking those little arrows by the search box. I suppose an alternative would be a macro to change the direction prior to Shift-Ctrl-F, but as you point out tampering with writer’s search engines is probably a worthless task.

I didn’t say “worthless”, I said “dangerous” :slight_smile:

If you do everything carefully, you can avoid mistakes. But for this you need to know all the mechanisms associated with the search and take into account the impact of your intervention in each of them. Not so complicated, but very painstakingly (honestly, it’s much easier to accustom yourself to little arrows)