Jump to content
Sign in to follow this  
IndyUK

ControlSetText doesn't appear to be working

Recommended Posts

IndyUK

Hi All,

I'm developing a script where I use the ControlSetText function to pass values to a fields on a form. However, the problem I've discovered is that none of the controls save their values when I save the form. Why is this? I then went and tried the ControlSend function which seems to work but the problem with this is the text is all lowercase. This I suppose is because this is sending keystrokes rather than a literal value.

Can someone recommend a fix/workaround to this? If there isn't one then I will begin work on writing a wrapper for the ControlSend function where it will send each key stroke based on the ASCII value of the text.

Thanks

Share this post


Link to post
Share on other sites
AdmiralAlkex

I don't understand what you mean, ControlSetText() do support uppercased characters, see:

$hWnd = GUICreate("test", 200, 100)
$hInput = GUICtrlCreateInput("", 20, 20, 160, 22)
GUISetState()

ControlSetText($hWnd, "", $hInput, "AaBbCc")

Do
    Sleep(10)
Until GUIGetMsg() = -3

Share this post


Link to post
Share on other sites
IndyUK

I don't understand what you mean, ControlSetText() do support uppercased characters, see:

$hWnd = GUICreate("test", 200, 100)
$hInput = GUICtrlCreateInput("", 20, 20, 160, 22)
GUISetState()

ControlSetText($hWnd, "", $hInput, "AaBbCc")

Do
    Sleep(10)
Until GUIGetMsg() = -3

The syntax I'm using is correct and the values I pass do get sent to the textbox. Problem seems to be that the application I'm controlling isn't setting the value instead just displaying it. I think the application is written in Borland so I don't know if that makes any difference.

Share this post


Link to post
Share on other sites
somdcomputerguy

ControlSend works with uppercase also, if the (not created by you) application doesn't save form values, maybe use ControlGetText to get those values and do something with them.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Bowmore

The reason the application is not saving the values you enter on the form using ControlSetText() is probably because the application only reads the content of the field when the user presses enter or tabs to another field.


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
IndyUK

The reason the application is not saving the values you enter on the form using ControlSetText() is probably because the application only reads the content of the field when the user presses enter or tabs to another field.

That's what I first thought, but then when I tried the ControlSend command that seems to work. I will however try once more as per your suggestion and see if I've missed something.

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  

×