It is intended for people with absolutely no knowledge of programming/scripting at all.
It also assumes you do not know how to use autoit3 help file.
What it does assume, is that you have installed autoit3 and scite4autoit which can be found here http://www.autoitscript.com/site/autoit/downloads/
The most important thing to know, is how to navigate and use the helpfile
Please do not underestimate how valuable this resource is.
So heres how we can find it, first click on your icon to bring up your start menu
It will look similar to this. And you need to click on "All Programs"
When you do, find and click on the autoit3 folder icon. you will see something like this
and you obviously need to click on the help file highlighted.
Once the helpfile loads you will see essentially two panels, the one on the left is about navigation
The one on the right is about information, and for now, just focus on the index tab and click it
to see something like this in the left panel
Notice it says "Type in the keyword to find", this is where we can find what we are looking for.
For example, if I want to find a string function, or browse all the string functions, I simply
type "string" into the field below the prompt, and it navigates automatically to the items in the
index, like so.
If you highlight one of the items in the list and hit enter, or double click on an item, it will bring up
information about that item in the right side panel, like so.
Above I clicked on the String function and it shows me everything i need to know about that function.
Firstly, it tells me in essence what it does. "Returns the string representation of an expression."
Secondly, it shows me how to enter the function into scite editor "String ( expression )"
In the scope of this post, the expession here is the paramater we pass to the function for processing.
A paramater is any variable or literal we put inside the braces of a function.
It also tells me the return value - "Returns a string." - a string it what is between those two quotes (text if you will)
So what is a return value? Its what the function pumps out after you pass it the correct paramaters, you can test it
in the example at the bottom of the right panel.
But not before you take a look at another important part of the information, The remarks.
"Maximum string length is 2147483647 characters (but keep in mind that no line in an AutoIt script can exceed 4095 characters.)"
Here its telling us that if we put a string of over 4095 characters on one line in our script, it will fail.
Never skip the remarks, it will cost you valuable time and cause you headaches.
Every time you are going to use a function, you should have that function open in the helpfile and refer to it every step of the way.
All the information in that panel is important, read it all, and then, notice the little button at the bottom of the example
entitled "Open this Script", press that, and the script will automagically open in your scite4autoit editor, and is ready to run, by hitting the F5 key
Q. What is a variable?
A. $this_is_a_variable = "this is a literal string"; A variable will always have the $ at the beginning
and never have a space in it (those are rules)
Look at the example
$var = String(10)
;$var is the string "10"
;$var is the variable here, and 10 is a literal paramater passed to the String function.
Lets take the String function out of the equasion and consider this statement (in the scope of this post a statement is information you type into scite which is telling autoit3 something it needs to know)
$var = 10
Here the variable $var is now equal to the literal value 10, it is named a variable because it can change its value.
$var = $var + 1
$var is now equal to 11, 10 however, will always be 10.
Lets have a look at another function, you remember how to find what we need in the helpfile? then find FileRead.
Heres what it tells us.
Read in a number of characters from a previously opened text file.
This means it will read into the variable it is assigned, (think $var) the amount of individual characters we want from a file that autoit3 has already opened.
FileRead ( "filehandle/filename" [, count] )
This is like a prototype of the function we will enter into our editor, notice the bracets "[" and "]" they are telling us that this paramater is optional!
filehandle/filename - The handle of a file, as returned by a previous call to FileOpen. Alternatively you may use a string filename as the first parameter.
Forget filehandle for now, filename here is the path to the file we want to read from, for example "c:\users\scripts\myfile.txt"
count - [optional] The number of characters to read. Default read the entire file.
Its quite common for beginners to misunderstand these [ and ], you dont type them literally into your script, they are just to let you know
that you can completely leave out that paramater if you do not need it. In this case, if you want to read the whole file into your variable ($var)
you would leave out everything between those bracets. If you do need it you would remove the bracets and enter your paramater.
Success: Returns the binary/string read. @extended is set to the number of bytes/characters returned.
This tells us the function will return a string if we gave it a filename as a paramater, since we are reading the file, the string will be the contents of the file.
Special: Sets @error to -1 if end-of-file is reached.
@error information tells us information about why the call to a function may have failed. It is important to check the @error state after each function you use.
Failure: Sets @error to 1 if file not opened in read mode or other error.
Looking at the example usually shows you how to check for errors.
If a filename is given rather than a file handle - the file will be opened and closed during the function call - for parsing large text files this will be much slower than using filehandles.
Note: Do not mix filehandles and filenames, i.e., don't FileOpen a file and then use a filename in this function. Use either filehandles or filenames in your routines, not both!
Both ANSI and UTF16/UTF8 text formats can be read - AutoIt will automatically determine the type.
A file can be read as binary(byte) data by using FileOpen with the binary flag - in this case count is in bytes rather than characters.
There are plenty of good tutorials on this forum created by various members, which is why it is important to know how to search the forums.
But hang on, this tutorial is about how to use the helpfile, so cast your mind way back to when we learnt how to find what we need
It was typing it into the index tab prompt field, so type tutorial into that, and you will find basic tuts in their also.
Edited by JohnOne, 30 March 2011 - 10:04 AM.