Jump to content

How to assign name of the control to a variable?


Recommended Posts

Look at ControlCommand() in the help doc. That should do what your asking.

Link to post
Share on other sites

Hi

I am having a combo box on my screen name: ComboBox1 with 2 values

I want to select the second value on the combobox

I am getting msg box with current selection as "0" focus is also working.

Control command is not working as expected

MsgBox(4160, "Information", "Cur Sel: " & _GUICtrlComboBox_GetCurSel("ComboBox1"))

ControlFocus ( "Deposit Information Entry", "", "ComboBox1" )

ControlCommand("Deposit Information Entry", "", "WindowsForms10.COMBOBOX.app.0.2bf8098_r13_ad13", "SetCurrentSelection", 1)

Please help

Link to post
Share on other sites

Don't use _GUICtrlComboBox_GetCurSel() unless the combobox was created by you using _GUICtrlComboBox_Create().

Does your "SetCurrentSelection" selection command work? if so all you should need is :

$selection = ControlCommand("Deposit Information Entry", "", "WindowsForms10.COMBOBOX.app.0.2bf8098_r13_ad13", "GetCurrentSelection", 1)
msgbox(0,'',$selection)

Also try to use the autoit tags when you post your code. You should see a square blue button with an A in it on the toolbar.

edit: woops. just changed that code

Edited by Beege
Link to post
Share on other sites

Hi

Thanks for your reply

I think i am not explaining my need properly. I am very sorry for that. I am new to autoIt so please

Scenario:

I am having a dropdown "ComboBox1" on my screen "Sceen 1" (Every Time when screen loads ID is keeps on changing).

combo box is not created using _GUICtrlComboBox_Create().

Combobox is having two values

a) AAAA (Default)

:) BBBB

I want to select "BBBB" in ComboBox1.

I tried above code both with GetCurrentSelection and SetCurrentSelection both are returning 0 as result.

Could you please help to overcome this situation

Link to post
Share on other sites

As the application you try to automate uses WindowsForms controls you might need to search the forum how to handle WindowsForms (one of the threads you'll find is ).

Unfortunately I've never automated such controls myself.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Link to post
Share on other sites

Where did you get "WindowsForms10.COMBOBOX.app.0.2bf8098_r13_ad13" from? Do you know how to use the Window Info tool? Make sure you are using values from advanced mode.

Heres a example to go with a pic:

$selection = ControlCommand("(UDF) ComboBox Create", "", "[CLASS:ComboBox; INSTANCE:1]", "GetCurrentSelection")

Posted Image

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...