Jump to content

How do I #include a file?


Recommended Posts

Hello everyone!! :idiot:

OK...here's what I wanna do:

#include AddBytes.au3

MsgBox(64, "El-Trucha's Byte Adder", "Open the file which you want to add bytes to.")
$file = FileOpenDialog("File", "C:\", "All Files (*.*)", 1 + 2)
$bytes = InputBox("How much bytes?", "How much bytes would you like to add?")
If @error = 1 Then Exit
If NOT StringIsDigit($bytes) Then NotANumber()

AddBytes($file, $bytes)

MsgBox(32, "Done!!", $message)

Func NotANumber()
    MsgBox(16, $bytes, "That's not even a number dude!!")
    Exit
EndFunc

I try to run that same file and it just shows me the "working" mouse cursor for 1 millisecond and then nothing happens...

I comment out the #include line and it tells me that AddBytes() is an unknown function, and it is, because it's in the included file!!

Why doesn't it work?? :lol:

Thanx!! ;)

P.S: I have tried putting the included script on where the script is and on a Include directory where the script is, because I don't have the installer... :D

El-Truchahttp://www.truchasoft.tk[url="ftp://tsfc.homeftp.net"]ftp://tsfc.homeftp.net[/url]hotline://tsfc.ath.cx

Link to comment
Share on other sites

Okay... is it double quotes or <>? I have seen a few different ways it has been done. Shouldnt there be 1 way to avoid confusion?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

Okay... is it double quotes or <>? I have seen a few different ways it has been done. Shouldnt there be 1 way to avoid confusion?

JS

<{POST_SNAPBACK}>

nope...

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!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The search order for files is different based on <> and "". Also, <> is common for library files (Standard or user-written) and "" is specific to a script. However, as long as all the file names are unique, #include "Test.au3" and #include <Test.au3> will resolve to the same file. However, if there are 2 different Test.au3 files that can be found along the search order, the results will be different.

Edit: Fixed typo.

Edited by Valik
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...