anixon Posted January 30, 2010 Share Posted January 30, 2010 This code gets the client size of the windows notification area Local $iMode = Opt("WinTitleMatchMode", 4) Local $hControl = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASSNN:ToolbarWindow321]") Local $acSize = WinGetClientSize($hControl) _arraydisplay($acSize) Is it possible to yet the x y width and height location of a specific Icon that appears somewhere on the notification area 'Skype' for example: Assistance is always appreciated Ant.. Link to comment Share on other sites More sharing options...
Yashied Posted January 30, 2010 Share Posted January 30, 2010 Maybe it will be useful for you.http://www.autoitscript.com/forum/index.php?showtopic=103871&st=0&p=735369 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
anixon Posted January 31, 2010 Author Share Posted January 31, 2010 Maybe it will be useful for you.http://www.autoitscript.com/forum/index.php?showtopic=103871&st=0&p=735369Thanks for that I have played with the software since your response and have been unable to get the $x $y position of the Icon. Silly question but if the Return is an array how do you then display the array produced by the called function? Ant.. Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 2, 2010 Share Posted February 2, 2010 (edited) Thanks for that I have played with the software since your response and have been unable to get the $x $y position of the Icon.The tray is just a toolbar control. You should be able to use things like _GUICtrlToolbar_GetButtonRect() on it.Silly question but if the Return is an array how do you then display the array produced by the called function? Ant..Very silly, since you used _ArrayDisplay() in your own code in the OP. Edited February 2, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
anixon Posted February 2, 2010 Author Share Posted February 2, 2010 The tray is just a toolbar control. You should be able to use things like _GUICtrlToolbar_GetButtonRect() on it.Very silly, since you used _ArrayDisplay() in your own code in the OP.Can you give me an example of _GUICtrlToolbar_GetButtonRectEX() for Skype that appears as an Icon in the Notification Area to the Toolbar Thanks Ant.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2010 Moderators Share Posted February 2, 2010 anixon,Here is a script that finds and clicks on a systray icon that you identify by the text content of the traytip - I have found it best to use the initial words of the traytip:expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber Global $sToolTipTitle = "" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 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 - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFuncIf you want the coordinates of the icon, then replace the _GUICtrlToolbar_ClickButton line with _GUICtrlToolbar_GetButtonRect or _GUICtrlToolbar_GetButtonRectEx.I hope that helps. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
anixon Posted February 2, 2010 Author Share Posted February 2, 2010 (edited) Is Get_Systray_Index($sToolTipTitle) missing from your code? Ant.. Please ignore I simply did not page down to see it must be to early in the morning.. Ant Edited February 2, 2010 by anixon Link to comment Share on other sites More sharing options...
anixon Posted February 2, 2010 Author Share Posted February 2, 2010 This code $Coordinates = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber) MsgBox(0,'',$Coordinates[0] & " " & $Coordinates[2]) Skype gives me these values for the x axis 54 Upper Left and 72 Lower Right how does that relate to Skypes position based on @DesktopWidth. In other words how would you translate the Upper left X access of the Skype Icon X position based on desktop width because I am pretty sure it is not @desktopwidth - 54. Ant.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2010 Moderators Share Posted February 2, 2010 anixon,Those coords are relative to the systray in which it sits - so you need to get the systray position (via WingetPos - you already have the handle ) and do little maths to get the screen coords. Or you could use _WinAPI_ClientToScreen - as you have to create a struct to use this there is probably not a lot in it.... M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 2, 2010 Share Posted February 2, 2010 (edited) That's the position of the button (icon) relative to the toolbar. Edit: Out typed by the Melba-bot! Edited February 2, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
anixon Posted February 3, 2010 Author Share Posted February 3, 2010 Thanks for the help this looks like it works I hope that the code is elegant enough this exercise has taught me heaps thanks again ...... Ant.. expandcollapse popup#Include <GuiToolBar.au3> Global $hSysTray_Handle, $iSystray_ButtonNumber, $xAxisNTB, $xAxisIcon Global $sToolTipTitle = "Skype" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here $iSystray_ButtonNumber = _Get_Systray_Index($sToolTipTitle) If $iSystray_ButtonNumber = 0 Then MsgBox(16, "Error", "Icon not found in system tray") Exit Else ;//'X' Axis Windows Notification Bar $xAxisNTB = WingetPos($hSysTray_Handle) ;//'X' Axis Icon on Notification Bar $xAxisIcon = _GUICtrlToolbar_GetButtonRect($hSysTray_Handle, $iSystray_ButtonNumber) ;//'X' Axis Skype Notification Toolbar Icon based on Desktop msgbox(0,"", "X Axis" & " NTB " & $xAxisNTB[0] & " Icon " & $xAxisIcon[0] & " X Pos Skype " & $xAxisNTB[0] + $xAxisIcon[0]) 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 - 1 If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop Next If $iSystray_ButtonNumber = $iSystray_ButCount Then Return 0 ; Not found Else Return $iSystray_ButtonNumber ; Found EndIf EndFunc 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