Jump to content

set text in text box, vb.net, AutoItX3Lib.AutoItX3


AlexR
 Share

Recommended Posts

Hello experts,

Ive got a little problem I hope someone could help me.

Yesterday I tried to use AutoItX3Lib.AutoItX3 to write a code in vb .net so execute my windows application.

My windows application contains just one Button and one textbox.

To click my button going well. Ive got no problem to use and click the button, but I cant write a text in my text box.

Here is my code:

Dim objAutoIt As New AutoItX3Lib.AutoItX3

objAutoIt.Run("C:\myapplication.exe")
objAutoIt.WinWaitActive("Form1")
  
'Press Button
objAutoIt.ControlClick("Form1", "", "Button2")

objAutoIt.WinClose("Form1")

To work with the textbox same way fails.

code like :

objAutoIt.ControlFocus("Form1", "", "TextBox1")
 objAutoIt.ControlSetText("Form1", "", "TextBox1", "Hello")

fails too.

Have someone a tip for me?

Best regards,

(desperated) Alex

Link to comment
Share on other sites

  • 4 weeks later...

Use Au3Info.exe to observe right ClassNameNN.

If I create a quick VB.NET app with a simple textbox and simple button the following are the control classes:

TextBox1 = WindowsForms10.EDIT.app.0.378734a1

Button1 = WindowsForms10.BUTTON.app.0.378734a1

Not sure why the ClassNameNNs are like that, but I'm sure it has something to do with the .NET framework. Use what Zedna suggested and use Au3Info.exe(AutoIT Window Info) to identfy the ClassNameNN.

post-33596-1206445240_thumb.jpg

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Link to comment
Share on other sites

  • 2 weeks later...

Just to add to what MattWise said, the class names are like that due to the .net framework, and just beware, if your apps are anything like ours these can actually change at runtime (which i discovered to my annoyance).

I retrieve the current classname for my main app/window using:

$windowClassName = _ReturnClass($titleMain)

which i then go on to use and/or modify for use elsewhere.

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...