Sign in to follow this  
Followers 0
dcyuri7

Nested Includes

6 posts in this topic

#1 ·  Posted (edited)

I am curious if you can, alike C++, include from a parent directory? I cannot get it to work, so I assume not. But is there another way to accomplish the same task?

For instance:

Directory "Bleh" contains two folders - Folder "apple" and folder "orange".

Inside "Bleh", I have test.au3 script, that includes "apple.au3" from inside the "apple" folder, thats all this script does.

Inside "apple.au3" (included from "test.au3"), I am trying to: #include "..\orange\orange.au3" , which doesn't pass the interpreter whatsoever, just says "Can't open include file".

-- Yes I could move the orange folder into the apple folder, and call #include "orange/orange.au3", BUT that isn't what I want. I need to be able to include from a parent directory.

Any ideas or suggestions? I'm trying to make my program more modular, but without 'nesting include files' using directories, I'll just have one include folder with a massive amount of include files( for my project that is, not the above example).

Thanks in advance,

Yuri

Edited by dcyuri7

Share this post


Link to post
Share on other sites



I am curious if you can, alike C++, include from a parent directory? I cannot get it to work, so I assume not. But is there another way to accomplish the same task?

For instance:

Directory "Bleh" contains two folders - Folder "apple" and folder "orange".

Inside "Bleh", I have test.au3 script, that includes "apple.au3" from inside the "apple" folder, thats all this script does.

Inside "apple.au3" (included from "test.au3"), I am trying to: #include "..\orange\orange.au3" , which doesn't pass the interpreter whatsoever, just says "Can't open include file".

Any ideas or suggestions? I'm trying to make my program more modular, but without 'nesting include files' using directories, I'll just have one include folder with a massive amount of include files( for my project that is, not the above example).

Thanks in advance,

Yuri

Try this:

#include "...\orange\orange.au3"

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try this:

#include "...\orange\orange.au3"
Thanks for quick reply. I tried that before posting acutally, just after reading the autoit help file on #include. But it still returns the same error, And im positive the files are in the correct location btw. muttley

*EDIT

I tried my example, and using "../orange/orange.au3" works perfectly. So I must be doing something else wrong. Gimmie a sec, gonna try and find my fault, sorry for posting a redundant thread lol.

Edited by dcyuri7

Share this post


Link to post
Share on other sites

Thanks for quick reply. I tried that before posting acutally, just after reading the autoit help file on #include. But it still returns the same error, And im positive the files are in the correct location btw. muttley

That's the proper way to do it... so if it still isn't working, you could always try this:

There is a special registry value that can be created at "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt" called "Include". It should be a REG_SZ (string) value. The contents of this value are a semi-colon delimited list of directories that should be searched for files when resolving #include's in addition to the standard locations.


Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Sweet, thanks a ton. muttley

*Edit, registry way works perfect. Just a simple RegWrite, and smooth nesting of includes. hehe Thanks again :)

Edited by dcyuri7

Share this post


Link to post
Share on other sites

That's the proper way to do it... so if it still isn't working, you could always try this:

I try to go into the registry to add the file needed to properly use my #include folder like in the example with how you helped out "dcyuri7". But when I follow the path HKEY_CURRENT_USER\Software\AutoIt v3\ I don't see the AutoIt Folder at all .Instead, all I see is this a ....AU3Info Folder and the Aut2Exe Folder. What should a man do in this predicament? :)

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