1

I am trying to use AutoIT within a C# application in the following way:

au = new AutoItX3Lib.AutoItX3Class();
.
.
.
.
au.WinMenuSelectItem("MySoftware", "", "&File", "&Open");

On compiling this I get the following error:
Error 1 No overload for method 'WinMenuSelectItem' takes '4' arguments

Going by the definition of WinMenuSelectItem (http://www.autoitscript.com/autoit3/docs/functions/WinMenuSelectItem.htm) I am not sure how I go about fixing this.

Thanks

2 Answers 2

2

Try adding empty strings for the remaining parameters.

au.WinMenuSelectItem("MySoftware", "", "&File", "&Open", "", "", "", "", "");
Sign up to request clarification or add additional context in comments.

2 Comments

When using AutoItX wrapper, you must provide 'something' for the optional arguments, in this case, empty strings will work.
Better use the Default keyword instead of "" for parameters that you don't want to set yourself.
0

That document is only tangentially relevant to you. You're using a .NET wrapper around a COM object - you need to find out what the interface is to that wrapper.

The problem is exactly what the compiler is telling you it is...there's probably no overload for this version of that method that takes 4 arguments.

If you're using Visual Studio, Intellisense will tell you what parameters are expected...or you can use the "Object Browser" (right click on the AutoItX3Lib reference in your project).

If you're not using Visual Studio, Red Gate Reflector is a free tool that will inspect the assembly for you. You could use that to figure out what parameters are expected.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.