Jump to content
Sign in to follow this  
fade2gray

noob with immediate problem with help file

Recommended Posts

fade2gray

Sorry to kick off with a noob whinge.

I've been presented with an au3 script to try which has a '#include' directive.

Wanting to understand how '#include' functions, I tried the following example from the help file...

;;; TIME.AU3 ;;;

MsgBox(0,"", "The time is " & @HOUR & ":" & @MIN & ":" & @SEC)

;;; SCRIPT.AU3 ;;;

#include "TIME.AU3"

MsgBox(0,"", "Example")

#include "TIME.AU3"

Exit

; Running script.au3 will output three message boxes:

; one with the time, one with 'Example', and another with the time.

The problem is that, "C:\Program Files\AutoIt\Include" does not contain a file called "TIME.AU3"

Thanks for any info.

Share this post


Link to post
Share on other sites
SpookMeister

As in, they want you to make one file called TIME.au3 with

MsgBox(0,"", "The time is " & @HOUR & ":" & @MIN & ":" & @SEC)

and one file called SCRIPT.au3 with

#include "TIME.AU3"
MsgBox(0,"", "Example")
#include "TIME.AU3"
Exit

As a result you will notice that when you run SCRIPT.AU3 you will get

; Running script.au3 will output three message boxes:

; one with the time, one with 'Example', and another with the time.

Basically they are just explaining to you that using #include just means that you are sticking the code from the other file that you reference into your current code.

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites
fade2gray

you are supposed to create both files yourself in the same directory.

Perhaps it would be more helpful if the help file read something like...

;;; Create in ...\AutoIt\Include - TIME.AU3 ;;;

;;; Create anywhere - SCRIPT.AU3 ;;;

but thanks anyway.

Sorry... SM - you got in there before I could hit the post button. :P

Edited by fade2gray

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  

×