Jump to content
Sign in to follow this  
BackHomeAgain

_GUICtrlToolbar_ClickButton

Recommended Posts

BackHomeAgain

Is there some method to get the listbox associated with a toolbar button after right clicking using the

_GUICtrlToolbar_ClickButton function?

The following code works after adding additional x,y values to MouseClick to click the desired

location in the listbox.  I would like to avoid the hard coded values.

Func _TrayNotifyArea()
    Local $hWind = WinGetHandle("[CLASS:Shell_TrayWnd]")
    Local $hButn = ControlGetHandle($hWind, "", 1502)
    Local $hTray = ControlGetHandle($hWind, "", "ToolbarWindow321")
    Local $bCount = _GUICtrlToolbar_ButtonCount($hTray)

    For $i = 1 To $bCount
        If _GUICtrlToolbar_GetButtonText($hTray, $i) == "xearth" Then ExitLoop
    Next
    
    ControlClick($hWind, "", $hButn)
    _GUICtrlToolbar_ClickButton($hTray, $i, "right", True)
    Local $mPos = MouseGetPos()
    MouseClick("left", $mPos[0] + 10, $mPos[1] - 15)
EndFunc

Share this post


Link to post
Share on other sites
BackHomeAgain

Realized that I used the a wrong term.  Instead of listbox, it should be context menu.  Anyway,  the menu may popup in a different

location depending on how close to the end of the taskbar.  By assuming, in my case, the menu will popup right of the mouse cursor

may not always work.  I do a ControlClick on the "Hide" button to stretch out the Toolbar to increase my changes of success.

The menu will disappear if I use AutoIt Window finder tool to get info from the menu.  I need some way to select a menu item

within the list.

Share this post


Link to post
Share on other sites
BackHomeAgain

Problem solved!!

Replaced:         Local $mPos = MouseGetPos()
                         MouseClick("left", $mPos[0] + 10, $mPos[1] - 15)

 

With:                 Send("{UP}")
                         Sleep(250)
                         Send("{ENTER}")
 

Share this post


Link to post
Share on other sites
FireFox

Hi,

Please use autoit tags to post your code next time :)

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×