Jump to content

ControlSend doesn't work as it should


Recommended Posts

Hi,

I'm using autoIt3 for automatic testing of GUI. At the moment I'm having a strange problem where I try to fill in a bunch of fields using autoIt3.

This is the relevant part of the script I'm using:

$iTeller2 = 1
While $iTeller2 < 51
    WinWaitActive("Media","InputForm")
    ConsoleWrite($iTeller2 & ". OK, add (another) media object" & @CR)
    ControlClick("Media", "InputForm", "WindowsForms10.BUTTON.app.0.378734a3", "left", 1)
    ConsoleWrite($iTeller2 & ". Opening media object screen..."  & @CR)
    Sleep($delay)
    WinWaitActive("Media Object", "")
    ConsoleWrite($iTeller2 & ". Media object screen opened"  & @CR)
    Sleep($delay)
    ControlClick("Media Object", "", "WindowsForms10.BUTTON.app.0.378734a2", "left", 1) ;opens a windows Open File screen
    WinWaitActive("Open", "")
    Sleep($delay)
    ControlSend("Open", "", "Edit1", $sMediaFile, "")
    ControlClick("Open", "", "Button2", "left", 1)
    WinWaitClose("Open", "")
    Sleep($delay)
    ControlSend("Media Object", "", "WindowsForms10.EDIT.app.0.378734a3",$sMediaTitle & $iTeller2)
    ControlClick("Media Object", "", "WindowsForms10.BUTTON.app.0.378734a6","left",1) ;ADD
    Sleep($delay)
    ControlSend("Media Object", "", "WindowsForms10.EDIT.app.0.378734a2", $sMediaTitle & $iTeller2)
    ControlClick("Media Object", "", "WindowsForms10.BUTTON.app.0.378734a4","left",1) ;ADD
    Sleep($delay)
    ControlSend("Media Object", "", "WindowsForms10.EDIT.app.0.378734a4", "description")
    Sleep($delay)
    ControlClick("Media Object", "", "&Ok", "left", 1)
    Sleep($delay)
    WinWaitClose("Media Object", "")
    $iTeller2 += 1          
WEnd

The problem is as follows: the first time the script goes through the while loop everything works great. When a second iteration occurs, the first character from $sMediaTitle mysteriously disappears, and the script understandably can't find the file to add.

What am I doing wrong here?

Thanks in advance,

Perrin

Link to comment
Share on other sites

I had a more or less similar problem, with writing some upper case chars as lowercase on the first char in a more or less random way.

I bypassed the issue by replacing the ControlSend command with a ControlSetText. It is much faster in in some strange way more accurate. If you use it , please check first the input limit of the fields and adjust the input with a StringLeft() .

Hope it helpes.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...