I'm not sure that there is a way of doing this via scripting alone. There is a dll available at mircscripts.org (wnd.dll) which I believe allows you to do this.