11globalForegroundWindow Max/Msp external to get and set the foreground app and window. 11globalForegroundWindow.c - Win source 11globalForegroundWindow.m - Mac source