RichardL Posted June 1, 2010 Share Posted June 1, 2010 Hello. I have a program that is minimised to system tray, and I want to activate it to normal window (and then click on buttons etc.) Yes I could probably find it by looking for its icon’s colours, not very clever. I know the program name, can I find the icon and send it a ‘double-click’ message? (I’ve tried WinActivate – no action.) Link to comment Share on other sites More sharing options...
Juvigy Posted June 2, 2010 Share Posted June 2, 2010 This example is about outlook: expandcollapse popupInclude <GuiToolBar.au3> #NoTrayIcon Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "Microsoft Office Outlook" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = -1 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else Sleep(500) _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") EndIf Exit Func Get_Systray_Index($sToolTipTitle) ; Find systray handle $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') If @error Then MsgBox(16, "Error", "System tray not found") Exit EndIf ; Get systray item count Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle) If $iSystray_ButCount = 0 Then MsgBox(16, "Error", "No items found in system tray") Exit EndIf ; Look for wanted tooltip For $iSystray_ButtonNumber = 0 To $iSystray_ButCount If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then MsgBox(0,$iSystray_ButCount,$iSystray_ButtonNumber) Return $iSystray_ButtonNumber ; Found EndIf Next Return -1 ; Not found EndFunc Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 2, 2010 Share Posted June 2, 2010 Juvigy, Since the instance # for the 'Notification Area' can vary between O/S's, you might want to alter the following line: $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]') to search for '[CLASS:ToolbarWindow32;TEXT:Notification Area]' on anything pre-Windows 7, and for Windows 7: "[CLASS:ToolbarWindow32;TEXT:User Promoted Notification Area]". My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
RichardL Posted June 3, 2010 Author Share Posted June 3, 2010 Thanks, it works. I've tried both versions on two different tray icons, I can't get to the real target program at the moment. Thanks again. Link to comment Share on other sites More sharing options...
DW1 Posted June 3, 2010 Share Posted June 3, 2010 For something simpler, if you know the window title: WinSetState('WINTITLE', '', @SW_RESTORE) SorryButImaNewbie 1 AutoIt3 Online Help Link to comment Share on other sites More sharing options...
RichardL Posted June 8, 2010 Author Share Posted June 8, 2010 Thanks danwilli, what I find is WinSetState is good for normal windows, including minimised, but doesn't work if minimised to system tray with no item in task-bar (or alt-tab window). Link to comment Share on other sites More sharing options...
Ascend4nt Posted June 8, 2010 Share Posted June 8, 2010 I just gave Juvigy's code above a try myself.. I didn't realize that if you have an 'Auto-Hide' taskbar, you'll need to Activate it, like this first (right before _GUICtrlToolbar_ClickButton): WinActivate('[Class:Shell_TrayWnd]') My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now