Jump to content

How To Convert DLLs into an AutoIT UDF?

Recommended Posts

Before getting into AutoIT, I used to use "Actiona" for simple automations. Specifically, the image recognition module used by Actiona was really good.

I may be punching above my weight here, but I'm wondering if it's possible for me to extract the image search functions from Actiona's DLL files and make an AutoIT UDF for them. AutoIT does everything else better, and it's 99% of my workflow these days. However, AutoIT's imagesearch functions aren't as robust as those used in Actiona.

How/where do I start, and what kind of timeframe am I looking at? I'm reasonably proficient in AutoIT, and procedural programming in general, having used it for a year, but I've never really looked inside a DLL.

I'm not asking to be spoonfed :) Would just like a rough roadmap or process outline from people who have made their own UDFs from DLL files.





Edited by noellarkin
Link to comment
Share on other sites

Actiona has an open-source C++ GitHub repository, so in theory it's possible to do what you want, provided:

  • you are sufficiently competent in C++ (your AutoIt skills are almost irrelevant in this respect) and comfortable with MSVC or similar compiler environment
  • the source is adequately documented (doesn't look like it) and modular (so the image-procesing part can be extracted easily;  haven't checked this), C++ can be written in a variety of styles (heavily OOP or not, multi-threaded or not, integrated with other language-based components or not, template-library based or not, etc)

Writing a c++ dll from scratch to integrate with AutoIt is fairly easy (example), but adapting someone else's existing code to function as a dll won't be, unless the original is already set up to be library/dll-based (if so, you'd just have to extract the required parts and write a wrapper library for it in AutoIt). The main problem I suspect will be the external parts your desired internal functions will rely on (the back-end of the back-end, if you will) which may be impossible/difficult to port to an AutoIt environment.

My advice: investigate other image-processing options (existing AutoIt UDFs and/or dll's) rather than spending ages trying to analyse whether all hidden dependencies are actually portable/extractable. In most cases, there are plenty of alternative ways to skin any particular cat.

Link to comment
Share on other sites

If you know the parameters of the DLL methods, you can call it directly with AutoIt DllCall function.  With the help of the source code, that might be one simpler way, than investing days to translate something that may not work in pure AutoIt.

Link to comment
Share on other sites

First I have to say, I am not a C/C++ Programmer, but after a quick look at the code in the git repository I noticed that Actiona uses OpenCV, especially the function matchTemplate (to find a image within an image) with various methods described here.

AFAIK there is an OpenCV-UDF in AutoIt, which i would prefer rather than using lots of interdependent dll´s of a 3rd party program.




Edited by AndyG
Link to comment
Share on other sites

12 hours ago, junkew said:

you can find many ways that are probably easier then to integrate the dll's (if they are documented it could be straight forward with dllcall function)

As I mentioned, I had a short look at the source. As good as none dokumentation, the source of Actiona is straight C++ based on the QT-Framework. All parameters which goes in and come out of methods/functions are going through the QT. I am experienced with DLL (I did a quick look at this with IDA also) and I would trust myself to use a function of an Actiona-DLL but at what price?! Definetely you have to complete install Actiona to use one/some of the functions! And even then it would take much longer and would be more complicated than writing this function from scratch. 

An other idea could be to automate Actiona with an AutoIt-Script....🙄😱


On 3/28/2022 at 7:33 AM, noellarkin said:

AutoIT's imagesearch functions aren't as robust as those used in Actiona.

@noellarkin, I would like to see an example or more of the images you are having trouble finding.

Link to comment
Share on other sites

Thanks for all the inputs! I didn't realize that Actiona uses OpenCV - - since this is the case, I agree with @AndyG and @junkew that using the existing UDF is far simpler for me at this point.

Unfortunately, my knowledge of C++ isn't where it needs to be for me to quickly reverse engineer the DLL file, but I intend to keep learning, so the tips by @RTFC and @Nine are invaluable.

Just to summarize the advice here, for anyone who stumbles upon this thread with similar questions about DLLs:

1. When reverse engineering DLLs, one's skills in the language the source application is written in (in this case, C++) is more important than experience in AutoIT.

2. The exent to which the source code has been documented and explained matters.

3. Extracting hidden interdependencies within the source application are an issue when trying to convert an existing set of DLLs into an AutoIT UDF, unless the source application has been written as a set of modular libraries or plugins.

4. In this specific example, since the Actiona Image Search function is based on OpenCV, it makes more sense to use AutoIT's OpenCV UDF, instead of trying to reverse engineer Actiona's functions, because Opportunity Cost.

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

  • Recently Browsing   0 members

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