Jump to content

Recommended Posts

Posted

I have two au3 files and I would like to backwards reference a function from an included file.

What do I mean by this? Simply stated, I have a script file 1.au3 and I am including 2.au3. I would like to reference the function a_test in 1.au3 from 2.au3 after it is included. How would I go about this?

Here is a quick example.

1.au3

#include "2.au3"

Func a_test()
    MsgBox(0, 'Test', 'It worked!')
EndFunc   ;==>a_testoÝ÷ Úȳz쥩ì·)^

Result of this is:

2.au3 : ERROR: a_test(): undefined function.

How do I reference a_test() so that the MsgBox pops up?

Figure IT out!http://vertigion.com

Posted

You call the function.

a_test()
So basically I've got compile issues. Let me reinstall autoit and hope for the best. Thanks. :)

Figure IT out!http://vertigion.com

Posted

Why not have all of your functions in it's own script then include that in both of the seperate scripts. Still not certain if that's what you're looking for but that's the best I can figure from the code you have.

Posted (edited)

I think you have the "#include" backwards:

1.au3 should be

Func a_test()
   MsgBox(0,"test","It worked")
EndFunc

2.au3 should be

#include "1.au3"

a_test()

Bob

Edited by YellowLab

You can't see a rainbow without first experiencing the rain.

Posted (edited)

You call the function.

This was correct. I re-installed the compiler and it worked ... /shrug.

Why not have all of your functions in it's own script then include that in both of the seperate scripts.

Cause I'm making a library of functions that will be included in many scripts. They will be managed by a set of functions in the main script that calls the library.

I think you have the "#include" backwards

Includes were not backwards, but thank you for your time and response. Edited by VertigoRay

Figure IT out!http://vertigion.com

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...