Jump to content
Sign in to follow this  
Ram

Include

Recommended Posts

Ram

I have written a function where I need to call another au3 file which is different directory.

Simple way: I can put

#include<path and test.au3>

but what happens If I don;t know the path. Is there any way to use @scriptDir or something like that in #include<> so that I don't need to enter the full path or different directory path in include all the time.... I actually tried @scriptdir didn't work? Can any one help me out with this?

Share this post


Link to post
Share on other sites
DW1

I do believe that the #include will look in both the \autoit\includes folder as well as the @scriptdir folder....

so if test.au3 is in the @scriptdir folder then

#include<"test.au3">

should work fine

Share this post


Link to post
Share on other sites
SmOke_N

I have written a function where I need to call another au3 file which is different directory.

Simple way: I can put

#include<path and test.au3>

but what happens If I don;t know the path. Is there any way to use @scriptDir or something like that in #include<> so that I don't need to enter the full path or different directory path in include all the time.... I actually tried @scriptdir didn't work? Can any one help me out with this?

If it's in the script directory... try doing:

#include "MyInclude.au3"


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Ram

If it's in the script directory... try doing:

#include "MyInclude.au3"

Nope didn't work..

for e.g script directory is in

c:\Scripttest\mainscript.au3

and the include script is in

c:\scripttest\test\script.au3

hence as of now I have typed in the mainsscript.au3 as

#include <"c:\scripttest\test\script.au3">

Now I am looking for something like

#include <@scriptDir & "\test\script.au3">

because I am not sure with the main directory folder name...It can be changed any time. So I don't want to keep editing the directory everytime.. Is this possible in #include?

Edited by Ram

Share this post


Link to post
Share on other sites
Nahuel

You can't use variables or macros as first parameter of FileInstall and you can't with #include either.

filename

The filename of the current script to include. Path is optional. This must be a string--it cannot be a variable.

If "..." is used, the filename is taken to be relative to the current script.

If <...> is used the filename is taken to be relative to include library directory (usually C:\Program Files\AutoIt3\Include). The include library contains many pre-written user-functions for you to use!

Share this post


Link to post
Share on other sites
SmOke_N

You can't use variables or macros as first parameter of FileInstall and you can't with #include either.

:) (is this a "In your face" moment ;) )

#include ".\test\testing.au3"

Edit:

In all fairness, he did say "Variable" or "Macro" which is correct.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
BrettF
Nahuel

:) (is this a "In your face" moment ;) )

haha, no no.. I'm only allowed to be rude to people once a day. :P Besides, I took that from the help file :P

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.