Thanks Clark, but it isn't just my macros. I'm noticing that SlickEdit is randomly taking focus, I think SlickEdit internal macros are using activate_tool_window() or something inside of it.
I've had my own macros for 4 years and in previous SlickEdit when I called activate_tool_window() it never caused SE to take the focus.
I think using _AppHasFocus() is a workaround, not the real solution. I could change my macros to use it but SlickEdit's macros will cause SE to take focus when I don't want it to.
I think it would be best if could have the old behavior where activate_tool_window() doesn't give SlickEdit the focus, it only activates the window inside of SlickEdit - but not giving SE the focus.
Can you check if this has changed in SE recently? Could I get the old behavior back? It is annoying to have SE take over the focus when I'm in the middle of typing in another window - even when it isn't my macros and it is SE's own macros doing this.
Additionally if I use _ApphasFocus() to not call activate_tool_window() then when I manually switch to SE the tool window that I wanted to have activated won't be activated. So the workaround of using _ApphasFocus() causes another problem in that when I do give SE the focus the desired tool window won't be activated.