Sign in to follow this  
Followers 0
59FIFTY

Run au3 files from a host process and pass data through

7 posts in this topic

I have a host process which should run .au3 files. The problem is that the .au3 files are made by the user and can contain certain errors which could corrupt the host process. So I decided to create a dedicated execute process which runs the .au3 files, that also works fine, but if i want to pass data between the host process and the .au3 file I'm running into problems.

I can pass data to the execute process, but not to the .au3 file. I tried to dynamicly include the .au3 file from the execute process by using Execute but that doesn't work. I know that I can pass data from the host to the execute and then to the .au3 file, but I don't want that, since the user should not include any functions or data to read from the STDIN in his own .au3 file.

Here's a little overview what the script should do:

1. host process generates $dataX = 1
2. host process runs execute process by using Run() and pass $dataX by using StdinWrite()
3. execute process parse $dataX by using ConsoleRead()
4. execute process generates Global variable $dataX
5. execute process dynamicly includes au3 file
6. au3 file has access to all functions and global variables of execute process
7. au3 file outputs $dataX by using ConsoleWrite()

Step 1 to 4 works fine, but I dont know how to make an enviroment for the .au3 file to provide access to all functions and variables of the execute process.

Share this post


Link to post
Share on other sites



You can only dynamically include a file when user has AutoIt installed, and still then your script needs to be closed and run again. Dynamically including inside a Exe file is impossible, I've tried it.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I thought that... but how can I create a "virtual" environment for the au3 file to run in? The only idea that works is this:

create a temporary au3 file containing all the data to be set for the au3 file and include the au3 file at the end, then execute the temp au3 file from the host process by using run. The drawback is that I have to write a tempfile for every execution, which can cause a lot of performance problems, but is the only method that works I guess?

Edited by 59FIFTY

Share this post


Link to post
Share on other sites

Basically, yes. For a script that would dynamically include things, I had included the compiler with the scripts. I used the compiler to create new executables and that way 'dynamically include' scripts. That might be an option for you.

Share this post


Link to post
Share on other sites

It works no with that temproary method. Yout method is good as well, but one drawback is still there, in both methods, what can you do about errors? Can you precheck the script with the compiler if there is any error? Or how can i supress errors from the script so they don't show up in a message box?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

@ptrex

Your dynamic COM Objects are great, but doesn't solve my problen, in fact my problem has vanished into thin air I got it to work. I have a now a host process which runs an executable process which also includes a temporary created au3 file. This way you can mess up the au3 file without corrupting the host process.

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