How to use SetControlText

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
KJ o
Newbie
Posts: 1
Joined: Tue Jun 14, 2005 11:35 am

How to use SetControlText

Post by KJ o » Tue Jun 14, 2005 11:45 am

I am trying to get the SetControlText to change the value of a combo box. As a test case, I am trying to change the Location combo box in the
Regional and Language Options. That window is already open.

When I run this:
---
let>npEdit=XX
setfocus>Regional*
GetControlText>Region*,ComboBox,2,npEdit
SetControlText>Region*,ComboBox,2,Syria
message>npEdit
---

I get a correct message, so the GetControlText works, but the SetControlText doesn't change anything. What am I doing wrong?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Jun 14, 2005 12:54 pm

You won't be able to change a ComboBox's value using SetControlText as other messages need to be fired to tell the application that it must update. To change a ComboBox value you will need to send keystrokes to simulate a user. If it is a ComboBox you should be able to just "Press Tab "to it and then "Send" the value you want it to be and this will select that value. If it is not an editable combo box then you will need to "Press Down" a number of times.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts