Sign in to follow this  
Followers 0
wchan2122

Inconsistent behavior for Controlsent() on datawindow control "pbdw70NN"

7 posts in this topic

I am trying to write a simple script which manipulates a custom application built with PowerBuilder.

For unknown reason, I get very inconsistent behavior when it comes to setting/sending text on a control

and sometimes it sends bad characters. Here's a sample:

So I have a few questions:

1. Why does ControlSend populate the text box with "ilLIAM WONG" instead of "WILLIAM WONG"?

2. Why does ControlSend only work 70% of the time?

3. Why does ControlSetText not graphically update the text within the actual text box?

In this regard, I want to read the text form the rows of datawindow control (contol class : "pbdw70NN") to validate

the input by "{TAB}" around to the elements and ControlSend() a "^c" to it, then get the data from the Clipboard.

but it not work for dropdown selection field.

MIP-Test.au3

Share this post


Link to post
Share on other sites



What you must realize is that PowerBuilder draws custom controls, as pointed out in your last thread. This means that it doesn't behave like standard windows, but rather simulates the behavior. In return, the simulation may not be 100% accurate for non-standard user operations.

This explains your questions. PowerBuilder window and control simulation is a little slow which causes ControlSend to occasionally miss a few characters. ControlSetText does not graphically update the text because the PowerBuilder simulation is handling the windows message to update the control wrong.

The same is true for the copy paste operations on the drop down field. PowerBuilder, again, handles the copy command wrong and sets you up with the wrong empty value. Try to work with the simulation, by doing some extra work in terms of afterwards validation, instead of against it.

Share this post


Link to post
Share on other sites

I've found in my app that when send does this I add sleep.

take for example

The brown fox jumped over the lazy dog.

if only

he brown fox jumped over the lazy dog.

was sent I would put something like Sleep(100) before the send.

(

Sleep(100)

Send("The brown fox jumped over the lazy dog.")

)

if it happens in the middle (and with my app it was always in the same spot)

The brown fox juped over the lazy dog.

then I would break up the send into multiple parts

(

Send("The brown fox jum")

Sleep(100)

Send("ped over the lazy dog.")

)

That has solved all of my missed or incorrectly typed sends so far :mellow:


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

What you must realize is that PowerBuilder draws custom controls, as pointed out in your last thread. This means that it doesn't behave like standard windows, but rather simulates the behavior. In return, the simulation may not be 100% accurate for non-standard user operations.

This explains your questions. PowerBuilder window and control simulation is a little slow which causes ControlSend to occasionally miss a few characters. ControlSetText does not graphically update the text because the PowerBuilder simulation is handling the windows message to update the control wrong.

The same is true for the copy paste operations on the drop down field. PowerBuilder, again, handles the copy command wrong and sets you up with the wrong empty value. Try to work with the simulation, by doing some extra work in terms of afterwards validation, instead of against it.

You know, I've wondered about that for a long time. I had a different app that had the same issue. This explains the issue I was having with it perfectly. Thanks!

Share this post


Link to post
Share on other sites

That has solved all of my missed or incorrectly typed sends so far :mellow:

What you can also try is to make Send a little slower, to give your application time to handle the messages.

See in the help file:

SendKeyDelay

SendKeyDownDelay

@Volly, good to know. There should be a topic or a part in the help file devoted to this, as it's quite important when dealing with non-standard windows.

Share this post


Link to post
Share on other sites

What you can also try is to make Send a little slower, to give your application time to handle the messages.

See in the help file:

SendKeyDelay

SendKeyDownDelay

I've tried Opt("SendKeyDelay", 45)

even up to 85, but it still always skipped in the same spots so that is when I broke it up and added the sleeps.


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

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