Jump to content

Using #include


niche99
 Share

Recommended Posts

Hi,

Coming from a C++ background, I want to create a "My Includes.au3". This will have the lines -

include-once

#include <file.au3>

#include "My Paths.au3"

... etc

I then want my default template for a new script to read (not a problem to do)

#include "My Includes.au3"

So when I have -

New Script.au3

#include "My Includes.au3"

...

_FileWriteLog($AutoIt_Script_Log, @ScriptName & ": Failed: Looking for " & $LookFor & " timed out.") <- This line causes an unknown function error message to be displayed.

Why, are includes not nested?

Thanks in advance,

niche99 (using latest version of autoit)

Link to comment
Share on other sites

Try:

#include-once
#include <file.au3>
#include <My Paths.au3>
;this file must be in Includes directory in Autoit dir.

and includeing it to you script:

#include <My Includes.au3>
Thanks for the fast reply. I would like to have "My Includes.au3" in another location. Is this possible?

niche99

Link to comment
Share on other sites

Includes from my desktop:

#include <C:\WINDOWS\Desktop\My Includes.au3>
Thanks for the fast reply. I now have another problem. Variables declared in "My Includes.au3" are not in scope in "New Script.au3".

eg.

"My Includes.au3"

Global $my_path

then

"New Script.au3"

Run ($my_path & "\some_app.exe") <- produces variable used without being declared error.

Thanks in advance,

niche99

Link to comment
Share on other sites

Thanks for the fast reply. I now have another problem. Variables declared in "My Includes.au3" are not in scope in "New Script.au3".

eg.

"My Includes.au3"

Global $my_path

then

"New Script.au3"

Run ($my_path & "\some_app.exe") <- produces variable used without being declared error.

Thanks in advance,

niche99

should be

Global $my_path = "some path"

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