Sign in to follow this  
Followers 0
niche99

Using #include

8 posts in this topic

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)

Share this post


Link to post
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>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Includes from my desktop:

#include <C:\WINDOWS\Desktop\My Includes.au3>

Share this post


Link to post
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

Share this post


Link to post
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"

Share this post


Link to post
Share on other sites

should be

Global $my_path = "some path"

Sorry, problem fixed, a typo. Eyesight going after 26 hrs straight coding.

Share this post


Link to post
Share on other sites

plz give all of code! and use [ code ] and [ /code ].Example:

[ code ](Without spaces);You script

;your script

;your script end[ /code ](without spaces)

so it should be:

;your script
;your script
;your script end

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