Jump to content

ToolBar item issue - (Moved)


Recommended Posts

I need to click on the second button in a toolbar(CLASS:WindowsForms10.ToolbarWindow32).

Issue is that not many of the _GUICtrlToolbar_xxxxx functions seem to work.

  • _GUICtrlToolbar_ButtonCount() - Correctly returns the number of buttons in the toolbar.
  • _GUICtrlToolbar_PressButton() - Works.
  • _GUICtrlToolbar_ClickIndex() - Crashes the target application.
  • _GUICtrlToolbar_IndexToCommand() - Crashes the target application.
  • _GUICtrlToolbar_ClickButton() - Always initiates the click on first button on using value 2 for command id.
  • _GUICtrlListView_ClickItem()  - Always initiates the click on first button on using value 2 for command id.

The details of controls got using UIAutomation are as below:

Quote


Title     = 
Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
Ctrl type = 50033
Ctrl name = pane
Value     = 
Handle    = 000F122A

    Title     = 
    Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
    Ctrl type = 50033
    Ctrl name = pane
    Value     = 
    Handle    = 001910E8

        Title     = 7%
        Class     = WindowsForms10.STATIC.app.0.21af1a5_r18_ad1
        Ctrl type = 50020
        Ctrl name = text
        Value     = 
        Handle    = 00100FFA

        Title     = 
        Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
        Ctrl type = 50033
        Ctrl name = pane
        Value     = 
        Handle    = 00150A6E

Title     = 
Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
Ctrl type = 50033
Ctrl name = pane
Value     = 
Handle    = 001A13A6

    Title     = 
    Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
    Ctrl type = 50033
    Ctrl name = pane
    Value     = 
    Handle    = 001A12E8

        Title     = ---%
        Class     = WindowsForms10.STATIC.app.0.21af1a5_r18_ad1
        Ctrl type = 50020
        Ctrl name = text
        Value     = 
        Handle    = 00131290

        Title     = 
        Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
        Ctrl type = 50033
        Ctrl name = pane
        Value     = 
        Handle    = 00180A18

Title     = 
Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
Ctrl type = 50033
Ctrl name = pane
Value     = 
Handle    = 00140974

    Title     = 
    Class     = WindowsForms10.Window.8.app.0.21af1a5_r18_ad1
    Ctrl type = 50033
    Ctrl name = pane
    Value     = 
    Handle    = 001B0E2C

        Title     = 
        Class     = WindowsForms10.STATIC.app.0.21af1a5_r18_ad1
        Ctrl type = 50020
        Ctrl name = text
        Value     = 
        Handle    = 00220E18

        Title     = /--:--
        Class     = WindowsForms10.STATIC.app.0.21af1a5_r18_ad1
        Ctrl type = 50020
        Ctrl name = text
        Value     = 
        Handle    = 00121506

        Title     = --:--
        Class     = WindowsForms10.STATIC.app.0.21af1a5_r18_ad1
        Ctrl type = 50020
        Ctrl name = text
        Value     = 
        Handle    = 0017170E

Title     = 
Class     = WindowsForms10.ToolbarWindow32.app.0.21af1a5_r18_ad1
Ctrl type = 50021
Ctrl name = tool bar
Value     = 
Handle    = 001E0DD4

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50031
    Ctrl name = split button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50031
    Ctrl name = split button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50031
    Ctrl name = split button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

    Title     = 
    Class     = 
    Ctrl type = 50000
    Ctrl name = button
    Value     = 
    Handle    = 00000000

The buttons do not have texts, so getting some handle using text is not possible.

Is there any way to initiate a click on the second button?

Thanks in advance.

 

Regards,

Amal

 

Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions. If it's super geeky and you don't know where to put it - it's probably here.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

59 minutes ago, JLogan3o13 said:

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Moderation Team

Hi Logan,

 

I am a first time user of this forum.

Can you tell me where you have moved it to?

On searching, I can only see this same post.

 

Regards,

Amal

Link to comment
Share on other sites

  • Moderators

The topic has been moved to the General Help and Support forum. If you look at the top of the thread, you will see the path:

image.png.fc3fa416485eb67885d46865b3bbb23b.png

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

16 minutes ago, Earthshine said:

last time I tried to use native autoit for those kinds of controls it would not work. Better to try UIAutomation, search the forum for that and see FAQ 31

Hi Earthshine,

 

Thanks for suggesting the UIAutomation FAQ 31 case.

I checked the same and used the simply spy to check the control.

But using the below code, I was still only able to get click on the first button in toolbar:

Quote

 

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

Local $oP1=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Launcher;controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.21af1a5_r18_ad1", $treescope_children)
_UIA_Action($oP1,"setfocus")
Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_ToolBarControlTypeId;class:=WindowsForms10.ToolbarWindow32.app.0.21af1a5_r18_ad1", $treescope_children)
_UIA_Action($oP0,"setfocus")
;~ First find the object in the parent before you can do something
;~$oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)
Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)
;~_UIA_action($oUIElement,"highlight")
_UIA_action($oUIElement,"click")

 

 

Without UIAutomation and _GUICtrlToolbar_xxxx functions, a click on second item can be managed with the below steps:

  • Get focus of tool-bar - ControlFocus()
  • Send {DOWN}{ENTER} so that click is made on the second item(button) - ControlSend()

Hope this helps someone who is desperate enough to use this.

 

Regards,

Amal

 

Link to comment
Share on other sites

13 hours ago, Earthshine said:

search forum for UIASpy, use that to spy around and see what it can tell you about the toolbar, or use other spy tools such as Inspect.exe

Hi Earthshine,

 

Thanks for the tools suggestion.

I had previously tried inspect and the only differentiating info was ChildId : 2.

But since normal AutoIt APIs like _GUICtrlToolbar_ClickButton() did not respond when 2 was passed as command id, I saw no use of it.

Today I tried UIASpy as suggested by you.

The tool looks great and I could see the below two properties were changing for each item of toolbar (apart from $UIA_BoundingRectanglePropertyId which I do not intend to use as it is based on co-ordinates):

  • UIA_LegacyIAccessibleChildIdPropertyId 
  • Parent to child index

But, I have no idea on how to use these to get access to the toolbar button.

Could be because I am new to AutoIt (especially UIAutomation) ☺️.

 

Regards,

Amal

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...