I think this should work, haven't tested it though:
code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
if(ChatWnd.Handle !== Interop.Call('user32.dll', 'GetActiveWindow')) {
var objShell = new ActiveXObject("Shell.Application");
objShell.ShellExecute("C:\\PATH\\TO\\THE\\BAT\\FILE\\ledflash.bat", "", "", "open", 0);
}
}