There is one window that we constantly have to go in and out of which is called the Table of Contents editor which consists of 4 different tabs. However no matter what tab you select the title of the window remains the same.
This is the window in question:

In this screen grab everything is as I want it to be, the window has focus and the heading (page 45 in this exampel) is highlighted in blue.
Sometimes however when Macro Scheduler sets focus on this window, it looks like this:

What's happened here is that focus is actually on the Pages tab itself (see the outline around the word pages).
This is causing me a lot of problems because the next thing to do is to rename that page by pressing F2. If the page is correctly highlighted as per the first screen grab I only need to press F2. However if it's like the 2nd screen grab then I need to press Tab and then press F2.
Is there a way I can either detect the colour of the highlighted area and if it's not blue then to press Tab first or to simply make sure that when focus is set on the window its set on the contents of the tab rather than the tab itself?
Just in case this has any impact on what solutions I could use the contents of this window will change, the highlighted section will change each time the macro is run (the macro will be set to loop), I'd rather not use x,y co-ordinates to simply perform a left click in the box because this window could be anywhere on the screen and the amount of text shown in that window will vary and affect where on the screen you could click.
Hope that makes sense!