change window focus before perferming an action

1.) some users here on the forum have attempted this with Apple Script, but I don't believe there is a 100% reliable solution ( Red Button of the last window quits the Application - Setup/Preset Sharing - BetterTouchTool Community ( )

2.) If I understand correctly that's expected behavior. Maybe you could workaround it by using advanced trigger conditions (using the hovered_element_details variable)