The problem was that "Reliance Netconnect" was a System tray Application i.e it resided in the system tray. You cannot use WinActivate to get their focus. they have to be redrawn. This worked for me
#Include <GuiToolBar.au3> #include "SysTray_UDF.au3" WinSetState("Reliance Netconnect" ,"",@SW_RESTORE) DIM $index=_SysTrayIconIndex("Reliance Netconnect", 1) ;MsgBox(1,"index",$index) _GUICtrlToolbar_ClickIndex(ControlGetHandle('[CLASS:Shell_TrayWnd]','','ToolbarWindow321'), $index, "left",False,2) WinActivate("Reliance Netconnect") WinWaitActive("Reliance Netconnect") send("") send("!c") WinSetState("Reliance Netconnect" ,"",@SW_MINIMIZE)
You can download SYSTRAY_UDF from here . If you get previously declared as a 'Const' errors change SysTray_UDF.au3 first lines to :
;~ Const $TB_DELETEBUTTON = 1046 ;~ Const $TB_GETBUTTON = 1047 ;~ Const $TB_BUTTONCOUNT = 1048 Const $TB_GETBUTTONTEXT = 1099 Const $TB_GETBUTTONINFO = 1089 ;~ Const $TB_HIDEBUTTON = 1028 ; WM_USER +4 ;~ Const $TB_GETITEMRECT = 1053 ;~ Const $TB_MOVEBUTTON = 1106 ; WM_USER +82 Const $WM_GETTEXT = 13 ; Included in GUIConstants ;~ Const $PROCESS_ALL_ACCESS = 2035711 Const $NO_TITLE = "---No title---" ; text that is used when icon window has no title