Activate Application if Minimized in Dock

Digging in for my undergrad degree in KM here. How do I reopen on windows in app that is minimized in my own macros. I've dug in the app and on the forum. The best I can find is a confusing wall of AppleScript. (see: Unminimize or Fullscreen - #3 by CJK)

In this I'm creating a global search shortcut for TheBrain:

The action part works well, I just can figure out easily how to unminimize the window if it has been minimized.