You would need to use a WindowMessage monitor to monitor the process of Messenger. What this will allow you to do is see the command that is sent when you double click on the tray icon and to what window so that you can reproduce the same in scripting.
i don't find a WindowMessage monitor
do you have that?i find an API monitor but it return me hundred of windows api from Messenger process...
nobody knows the true api?
I am not at home to check. I can tell you that it would be a WM_COMMAND used with SendMessageW but what the CMID (CommandId) that is sent and to which window I am not sure, not off the top of my head.