Can't set AppleScript as a trigger - Macro says "None"

If it's the open and closed status of a particular window you are looking for, I believe @Airy has been quite clever at checking menu items to determine status of otherwise unscriptable things (Firefox text fields!). He might have something up his sleeve to use when the focused window trigger fires.

It might help to confirm or reclarify under what conditions you want the MIDI action to run and not run.