Need some scripting help for an AutoHotKey Project

I have a fun project that I plan to share once I finalize how I want to handle this last piece.

The TLDR is that, I’m using a small remote keypad with AutoHotKey to automate some functions and clicks within TrainerRoad and Zwift to make them a bit more easy to navigate between. Things like changing intensity, extending workouts, switching between Erg and Resistance, using Zwift Powerups, etc.

My issue is that TrainerRoad runs 3 Windows all with the same title of TrainerRoad and the same Class, but only one of them is useful for receiving clicks and keystrokes. I am looking for a reliable way to identify that one key window. Does anyone with some autohotkey experience or any other windows scripting experience know of any good ways to do this using some object info that I haven’t thought of yet?

What I’ve done that works

  1. Loop through the 3 TrainerRoad windows programatically until one activates the window and then grab the handle of that window and use it going forward. Problem is, I have to see the window activate to know it is the right one and I have to respond to a msgbox telling it that is the right one.
  2. Use GroupActivate to activate each window iteratively until I see my other keys presses work with it, then grab the handle and use it going forward.

Despite how goofy it sounds, the second option works the easiest, but would much rather be able to identify it programmatically so I don’t have to waste a button on grabbing the right window handle.

Any thoughts?

Other than this little annoyance, the rest is going very well. I plan to have these features and will share the solution with the group.

  • Increase Intensity 1%
  • Decrease Intensity 1%
  • Increase Intensity 10%
  • Reset Intensity to 100%
  • Toggle Erg/Resistance
  • Extend Workout 10 minutes
  • Extend Workout 5 minutes
  • Extend Workout 1 minutes
  • Undo Extend
  • Use Zwift Powerup
  • Zwift Reverse Direction
  • Zwift Default View
  • Zwift Rear View
  • Zwift Kudos
  • Zwift Screenshot

I even have a pretty neat Dial on the keyboard I can use to individually turn on each of 4 fans using Webhooks, IFTT, and Smartlift Smart Outlets.