Jump to content

Running AU3 from within another AU3


Recommended Posts

I have two AU3 scripts, say:

wrapper.au3

chocolate.au3

chocolate.au3 has some code without any UI

wrapper.au3 calls chocolate.au3 to execute. Once the execution of chocolate.au3 has completed, wrapper continues with the rest of its code. How do you get wrapper to launch chocolate and wait till its execution is complete?

I've tried implementing it through processwaitclose() but it failed..

Wrapper code is goes like this

statement1
statement2
$cpid=Run("C:\Program Files\AutoIT3\AutoIT3.exe C:\whatever\chocolate.au3")
ProcessWaitClose($cipd)
statement3
statement4

When I run wrapper, the above code executes statement3 in wrapper immediately after launching chocolate. How do I get it to wait till chocolate.au3 has completed execution?

Any solutions?

Thanks in advance,

Link to comment
Share on other sites

Put Chocolate.au3 in the same dir as the wrapper.au3 then at the top of your code, put this #include "chocolate.au3" :)

Jee!! .. simple solution :D ..

However, putting #include at the top (as it should) would execute code within it before anything else..

I tried squeezing it in between my statements in wrapper, and it seemed to work without complaints, even with multiple include lines to the same file. ..

Looks a little funny, .. probably isnt best practice either ... but hey!... it works :( ..

Thanks for the simple solution :D

My wrapper looks like this now:

statement1
statement2
#include<chocolate1.au3>
#include<chocolate2.au3>
#include<chocolate1.au3>
#include<chocolate2.au3>
statement3
statement4
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
 Share

  • Recently Browsing   0 members

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