Jump to content

Includes with new AutoIt Version


Recommended Posts

I am having problems with includes in the newest version of AutoIt. Every script that I have made now doesn't work if I recompile it with the new version. For some reason, it isn't including all the #includes when compiling to an .exe. Is this a version bug?

Edit: I can compile the exact same script with both versions, and the newest version has errors with the includes. 3.2.2.0 compiles it correctly.

Edited by dufran3
Link to comment
Share on other sites

I am having problems with includes in the newest version of AutoIt. Every script that I have made now doesn't work if I recompile it with the new version. For some reason, it isn't including all the #includes when compiling to an .exe. Is this a version bug?

Edit: I can compile the exact same script with both versions, and the newest version has errors with the includes. 3.2.2.0 compiles it correctly.

1) what's the error?

2) how does your #include statement look like?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

you have already been told.... put them in the new autoit include directory

Edit: typo

Includes will be searched within the same directory as the main script.

If you have a script named "test.au3" and have a script named "testinclude.au3" in the same directory, then using this code works fine for me.

test.au3

#include <testinclude.au3>oÝ÷ Ú׬¶)Üç^jíÚºÚ"µÍÚ[ÛYK[ÛÙBÙÐÞ
    ÌÎNÝÝ   ÌÎNË ÌÎNÓÒÉÌÎNÊ

Edit:

Fixed code

Edited by MHz
Link to comment
Share on other sites

Ah, perhaps this is what he is missing?

"#include-once"

From the include au3?

Or perhaps this is what is missing.

#include <wecanonlyspeculateuntilhedoesnotprovidefurtherinformation.au3>

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

Ah, perhaps this is what he is missing?

"#include-once"

From the include au3?

"#include-once" is just a directive so the include is not added a 2nd time. It has little to do with searching for includes. :whistle:
Link to comment
Share on other sites

#include <Log_Functions.au3>

The Log_Functions.au3 include is in the same directory as the script that is including it. I also tried including ButtonConstants.au3 and GuiConstantsEx.au3 and the script could not evaluate the variables in that script after being compiled.

The error I am receiving varies. If I have a script...for example...here...I will write one really quick...hold for more...

Edited by dufran3
Link to comment
Share on other sites

hmmm... Main script...

;This is a test
#include <include.au3>

MsgBox(0,'Testing','This is the first messagebox, it is in the main script')
_IncludeMessageBox()oÝ÷ Ú)Üç^~)^jëh×6Func _IncludeMessageBox()
MsgBox(0,'Include Message Box','This is the message box in the include file')
EndFunc

And it works. For some reason, in almost every script I have created previous to the newest autoit version, I get an error with any custom function or variable that is supposed to be included....ONLY AFTER THE SCRIPT IS COMPILED.

Link to comment
Share on other sites

Hi,

I tried to write a script for manageing includes. Maybe it is worth a try ...

See my sig.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Found out the problem. I had a main script.

Main.au3

In that script I had an #include file...which was a list of all my functions.

Functions.au3

In that script I had an #include file...which handled all my logging.

Log_Functions.au3

All the errors were coming from the Log_functions.au3. To resolve the problem. I had to change the #include from the functions.au3 file to the main.au3 file.

Is there a problem including an include?

The structure of the includes looks like this

Main.au3

Functions.au3

Log_Functions.au3

Do you get me?

Edited by dufran3
Link to comment
Share on other sites

It is so weird. If I open up my script with scite and run it, it works fine. If I compile it. It doesn't see anything in the includes.

well, I tried it here. Works as described in the help file:

The search order used by AutoIt depends on which form of #include you use. The tables below show the order directories are searched using both forms.

Using #include <>

Standard library The path of the currently running interpreter with "\Include" appended is searched.

User-defined libraries The registry value mentioned above is read and each directory is searched in the order they appear in.

Script directory The directory of the currently executing script.

Using #include "" (This is the reverse of #include <>).

Script directory The directory of the currently executing script.

User-defined libraries The registry value mentioned above is read and each directory is searched in the reverse order they appear in.

Standard library The path of the currently running interpreter with "\Include" appended is searched.

I tested with this:

1.) Create d:\temp\au3\test.au3

#include <inc.au3>
MsgBox(0,"","IN Script")

2.) Create d:\temp\au3\inc.au3

MsgBox(0,"","IN INCLUDE")

It shows BOTH MsgBox() windows if run via SciTe or compiled to exe, so must be a problem on your system.

Unless you provide the error message and two reproduction scripts, nobody can help you!

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

You are one include short. My problem is going 3 deep. It doesn't look like I can reproduce it with a little msgBox script though.

C:\temp\Main.au3

;This is a test
#include <include.au3>

MsgBox(0,'Testing','This is the first message box, it is in the main script')
_IncludeMessageBox()
_IncludeMessageBox2()oÝ÷ ÙÍ=Úצ§Ovw%¹×¶jíÚºÚ"µÍ[ÈÒ[ÛYSYÜØYÙPÞ
BSÙÐÞ
    ÌÎNÒ[ÛYHYÜØYÙHÞÌÎNË  ÌÎNÕÈÈHYÜØYÙHÞ[HÜ[ÛYH[IÌÎNÊB[[

now the problem was calling that _IncludeMessageBox2() function, that is where it was hanging up. I can't reproduce it using this simple script however...hrmmm..

Link to comment
Share on other sites

I can't reproduce it using this simple script however...hrmmm..

still. What's the error message when you compile the script?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

I don't think you understand. The error message is always referring to a variable or custom function. For example. If you compile that script. But take out the include. It will give you an error because it cannot find the function. However, I have resolved it by including all files in the main .au3 file. it would give me that error for each function/variable that was included in the include...

C:\Script Tests\MsgBox\main.au3 (5) : ==> Unknown function name.: 
_IncludeMessageBox() 
^ ERROR
Edited by dufran3
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...