I'm using an AutoIT script for this type of function.
[url=http://www.hiddensoft.com/AutoIt/]http://www.hiddensoft.com/AutoIt/[/url]
Copied from another post -
As an example of a script:
This .AUT script is linked in an application to one gesture. Perform the gesture with a particular window closed - it opens. Perform the gesture with that window open - it closes.
----
IfWinExist,<WindowName>,,goto,close
goto,open
close:
WinClose,<WindowName>,,
goto,end
open:
Send,<Some keystrokes or mouse-clicks to open window>
goto,end
end:
-----