Sign in to follow this  
Followers 0
Vinodh

How to assign name of the control to a variable?

9 posts in this topic

Hi Friends

How to assign name of the control to a variable?

Thanks

Vinodh Anandhan

Share this post


Link to post
Share on other sites



My application is an external one so i found name of the control (combobox) using "AutoIT v3 window info" tool.

Now i want to set value of the combo box. How to assign the combobox name to a variable or how to set value to combobox?

Share this post


Link to post
Share on other sites

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

Share this post


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


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

Share this post


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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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

Share this post


Link to post
Share on other sites

Hi

I found solution to select value in combobox which is windowsFormsContrl

1. I set focus on that control

2. then send down

right now i have only two values. This is ok for me..

Thanks for help

Vinodh

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  
Followers 0