External Execute UDF Functions

3 posts in this topic

The Kandie Man 3

This is a UDF i wrote. I thought this could be quite handy. It contains three functions. One function is used to run an external au3 script, adding a sort of psuedo "multithreading" feature to compiled autoit scripts. Keep in mind it isn't actually multithreading, but simply one way to get around the multithreading limitation in autoit.

The next function lets you run a single function from within an external script.

The last function is a special function that i wrote that creates an autoit script host. When the function is called it installs an autoit executable on the target machine and associates the .extau3 file extension with itself. As a result the target machine can now run uncompiled au3 scripts with the .extau3 file extension as well as .a3x files with the .extau3 extension.

[EDIT]

Another way of looking at this is it essentially allows you to execute scripts like external link libraries. My one function allows you to call a function within a script, much like the way you would call a function inside a dll.

In addition, you can simply have the entire script executed. This makes it easy for you to leave some parts of the program open source. For example, you could have a function that places folders or files in a certain place and the user could then go into the script itself and modify it. Then when they run the compiled au3 script that isn't open source, it will be able to run the user-modified script like a custom dll.

The last function is a function all of its own. When used with the source provided in the source box below, it will allow you to create an autoit script host on the target users computer. This will cause autoit to run essentially like the microsoft script host that allows the executation of vbs scripts. The full compilation of autoit scripts would therefore not be required in order for the target user to execute autoit scripts without autoit installed. In addition, you could simply send the target machine .a3x files(compiled source files that only contain a compiled version of the source and are therefore extremely small, but not readable). Please note that the extension for these files is .extau3 I did this to prevent conflicts with computers that already had autoit installed.

The following code is what i used to create an autoit script host with my _FileAU3Associate function:

#NoTrayIcon#include "ExternalExecute.au3"If@AutoItExe=@ProgramFilesDir&"\AutoItExternal\AutoItExt.exe"Then_FileAU3Associate()Elsedim$answer$answer=MsgBox(36,"Install?","This will install an autoit executable on your computer and associate the extension .extau3 with it. This computer would then be able to run uncompiled .au3 files with the .extau3 extension was well as .a3x files with the .extau3 extension."&@CRLF&@CRLF&"Installation is done to your program files directory and consists of only one 190KB executable. "&@CRLF&@CRLF&"You may uninstall the program at any time by going to Program Files\AutoItExternal\ and running AutoItExt.exe."&@CRLF&@CRLF&"Do you want to install this AutoIt script interpreter?")SelectCase$answer=6;Yes_FileAU3Associate()MsgBox(64,"Installed","Autoit Script Interpreter was successfully installed."&@CRLF&@CRLF&"You may now run .extau3 files.",5)Case$answer=7;NoExitEndSelectEndif

This the first version, please report any bugs that you may encounter as well as any questions you may have.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post

Link to post

Share on other sites

The Kandie Man 3

No, haven't done a whole lot of work on it since i wrote it. If there is more interest in it, I would always be willing to re-write some stuff or add user requested functions. It seems there have been significantly more downloads since i last checked. I may do a re-write if it continues. I was shocked that nobody really took much notice when i first posted this, but i suspect that most people really didn't know what this did or how it could be effectively used in their scripts.

-The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire