Sign in to follow this  
Followers 0
PythEch

How to use AutoItX in Boo

5 posts in this topic

#1 ·  Posted (edited)

Hi, everyone. First, you can use functions but can't see them on function explorer (Ctrl + Space) and I did this in SharpDevelop 3.1.

1-You need to register the Dll if you can't it see on COM.

1a-To check it, open SharpDevelop, go to Project>Add Reference>COM:

Figure-1:

Posted Image

1b-If you can't see it, you must register it. To register it, go to Start>Run then type "cmd.exe" without quotes. Type "cd <AutoItX3.dll's folder's path>" without quotes. And finally, type "regsvr32 AutoItX3.dll" without quotes.

Figure-2:

Posted Image

2-Now, you have it on COM. Add it as reference like on Step 1a and Figure-1. When you finish it, you can see it on Projects tab:

Figure-3:

Posted Image

3a-Add "import AutoItX3Lib" to your project. (Figure-4).

3b-Add "au3 = AutoItX3Lib.AutoItX3Class()" to use AutoIt functions. An example of using the code: "au3.WinActivate("Untitled - Notepad","")" But you can't see the functions on class explorer. (Figure-5)

3c-(Optional) Add "private static au3 as AutoItX3Lib.AutoItX3Class" to your codes. If you will use "au3" in more than one function etc., add this code. You won't need to set au3 per function. Once you set au3, it can be used by other functions. Seting 3b on form load can be a good idea. (Figure-6)

Figure-4:

Posted Image

Figure-5:

Posted Image

Figure-6:

Posted Image

Note: If you want to get function detials/help, click here.

Edited by PythEch

Share this post


Link to post
Share on other sites



Edit on post for Step 3c:

3c-(Optional) Add "private static au3 as AutoItX3Lib.AutoItX3Class" to your codes. If you will use "au3" in more than one function etc., add this code. You won't need to set au3 per function. Once the au3 variable processed on program execution, it can be used by other functions. For example, I used it on Button1Click. User clicked button1, au3 setted, function called, function used au3. This will work. But if you use that function without clicking button1, program will throw runtime error because of au3 didn't set. Seting 3b on form load can be a good idea. (Figure-6)

Share this post


Link to post
Share on other sites

I've not worked with SharpDevelop very long, but is it possible that it just can't read COM data? Do other COM objects show up with the function lists?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I've not worked with SharpDevelop very long, but is it possible that it just can't read COM data? Do other COM objects show up with the function lists?

I added the DLL by browsing, not COM. It readed the all classes. It can be seen by classes table But can't seen when press Ctrl+Space. And can't use the DLL. Debugger shows to me errors when that code being processed. I don't really know SharpDevelop more than you. But, it's not Boo's problem really. Same problem happens in C# too. Boo uses C# compiler and written C# btw. Maybe because of 3.1 version is beta yet. I use the beta because, in stable release, Boo has x64 OS problems. Compiler says can't compile x64 but can't set it to x86. In the new beta version, it can be done.

Dynamic languages has advantages, when they are not commercial, more advantages. Same thing happens in static languages. But, when you have dynamic and static lang, you have advantages twice. :D

Edited by PythEch

Share this post


Link to post
Share on other sites

It's still COM even if you didn't use the COM registry. COM provides the class details, the dll on its own does not.

I'm not sure what that last part meant but in response to your problem, yes it is possible that the problem is the beta version. You might try asking the creator of Boo (I've never heard of it) or some support forum about possible COM use problems.

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