Jump to content
Sign in to follow this  
Apostelman

ControlSend works from SciTE, not from C# ?!

Recommended Posts

Apostelman

Hi,

i'm trying to implement AutoitX into my C# Project. I Created a ClassLibrary and added the AutoItX3.Assembly

In my Console Project i added the 3 .DLL Files which get copied to the output directory as well.

I was able to activate windows, send keys to the focused window and so on...

What doesn't work are the commands ControlSend or ControlSetText. I use them like this:

AutoItX.Send("{ENTER}");
AutoItX.Sleep(3000);
AutoItX.Send("{F6}");
AutoItX.ControlSetText("My Window Title", "", "[NAME:MyTextBox]", "TEST");

ControlSetText just returns 0, nothing happens... If i use the SAME excact code in SciTE everything works like a charme

One thing that works from within C# is the following

AutoItX.Send("{ENTER}");
AutoItX.Sleep(3000);
AutoItX.Send("{F6}");
AutoItX.ControlSetText("", "", "WindowsForms10.EDIT.app.0.2bf8098_r13_ad121", "TEST");

No Window-Title and the ugly Class-Name+Instance.

What am i doing wrong? Why is the first code returning 0? Is the a hidden error-message somewhere to be found?

 

Apo

Share this post


Link to post
Share on other sites
wangzhengbo

Hi,

i'm trying to implement AutoitX into my C# Project. I Created a ClassLibrary and added the AutoItX3.Assembly

In my Console Project i added the 3 .DLL Files which get copied to the output directory as well.

I was able to activate windows, send keys to the focused window and so on...

What doesn't work are the commands ControlSend or ControlSetText. I use them like this:

AutoItX.Send("{ENTER}");
AutoItX.Sleep(3000);
AutoItX.Send("{F6}");
AutoItX.ControlSetText("My Window Title", "", "[NAME:MyTextBox]", "TEST");

ControlSetText just returns 0, nothing happens... If i use the SAME excact code in SciTE everything works like a charme

One thing that works from within C# is the following

AutoItX.Send("{ENTER}");
AutoItX.Sleep(3000);
AutoItX.Send("{F6}");
AutoItX.ControlSetText("", "", "WindowsForms10.EDIT.app.0.2bf8098_r13_ad121", "TEST");

No Window-Title and the ugly Class-Name+Instance.

What am i doing wrong? Why is the first code returning 0? Is the a hidden error-message somewhere to be found?

 

Apo

 

Maybe you used wrong controlId in 

  1. AutoItX.ControlSetText("My Window Title", "", "[NAME:MyTextBox]", "TEST");

Share this post


Link to post
Share on other sites
Apostelman

no, the code wouldn't work in scite either. but it does

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  

×