Jump to content

Include


Ram
 Share

Recommended Posts

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?

Link to comment
Share on other sites

  • Moderators

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

  • Moderators

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.

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