Sign in to follow this  
Followers 0
c.haslam

When a script is run from another script, do they share the same namespace?

4 posts in this topic

Consider script foo.au3:

   Doit()

   Func DoIt()

      RunWait('"'&@AutoItExe&'" "'&@ScriptDir&'bar.au3"')  

   EndFunc

and script bar.au3:

   DoIt()

   Func DoIt()

      some lines of code here

   EndFunc

Scripts like this didn't run properly. When I changed DoIt in bar.au3 to DoIt2, the scripts ran correctly. I think this was the only change I made.

So was bar.au3 seeing foo's DoIt function rather than its own?


...chris

Share this post


Link to post
Share on other sites



Just tested it and it works fine on the latest stable autoit.

; FOO.au3
Doit()
Func DoIt()
    msgbox(1,"DOIT","This is doit run from foo.au3:   next running BAR.au3")
    RunWait('"'&@AutoItExe&'" "'&@ScriptDir&'\bar.au3"')
EndFunc



; BAR.au3
DoIt()
Func DoIt()
    msgbox(1,"DOIT","This is doit run from bar.au3")
EndFunc

Share this post


Link to post
Share on other sites

Thanks


...chris

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