Jump to content

Changing a combox on WindowsForm


Recommended Posts

Previously I changed a combo box (for another program) 

Local $hWnd3= WinWait("[CLASS:ProMainWin]", "", 10)
$hComBo1=ControlGetHandle($hWnd3, "", "ComboBox4")
Sleep(1000)
_GUICtrlComboBox_SetCurSel($hComBo1, 35)

However I googled autoit combo boxes and came across about Windows Forms (which I assume is what I'm dealing with given the control class) and tried it this way which was the answer after googling. 

; ---------------------------------------------------------------------------
        ;Action: Change Combo box to "Elite Matter Number" 
        $hComBo1=ControlGetHandle($hWnd, '', 'WindowsForms10.Window.8.app.0.338574f_r42_ad112')
            if @error then 
                Msgbox(16, "Error", "Cannot ControlGetHandle the dropdown combox to select Elite Matter Number") 
            endif
        Sleep(1000)
        ;_GUICtrlComboBox_SetCurSel($hComBo1, 6)
        _GUICtrlComboBox_SelectString($hComBo1, "Matter Management - Elite Matter Number (File Cover) (FCO06)")
                if @error then 
                    MsgBox(16, "Error", "Cannot select Combo box") 
                EndIf
        ; ---------------------------------------------------------------------------

It quits the program though and outputs this at console 

$hComBo1=ControlGetHandle($hWnd, '', 'WindowsForms10.Window.8.app.0.338574f_r42_ad112')
$hComBo1=ControlGetHandle(^ ERROR
>Exit code: 1

I wonder why it doesn't trigger the if @error statement and just ends? 

Link to comment
Share on other sites

Trying to control a windows 10 form isn’t going to work in native auto IT  it’s not a win32 form nor are the controls win32

you can use UIAutomation 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

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...