(Note: If you have already installed the SciTE editor, it will edit the script instead of the system's own Notepad.) )
First open the folder you want to create the script, click the right mouse button and then select new /autoit v3 script in the menu.
Name the script file as helloworld.au3. Note the extension should be . au3-- This indicates that the file is a AutoIt v3 script.
We've created the script file, and now all we have to do is edit the script so that it has the functionality we need. Right-click the helloworld.au3 script file and select Edit Scriptin the menu.
You will then use the Notepad program to open the script, and you will see something like this:
The code you see is nothing more than a comment that facilitates organizing scripts. It also prompts for "options" to be used later. Each line of the code begins with a semicolon, so they will be interpreted as annotations to the script (that is, it will be ignored), similar to the DOS-ignored command line specified in the batch file in the DOS.
Well, now we're going to tell AutoIt what to do is display an information box--the MSGBOX function can be implemented.
Add the following at the bottom of the code:
MsgBox (0, "guide", "Hello world!")
All functions have parameters, and the MsgBox function has three parameters--identification, title, and information. The number in the ID is used to change the display style of the message box-we try 0now. Both the title and the information are string arguments--the string must be enclosed in double quotes or single quotes for the text in the AutoIt, which means that "this is some text" or "This is some text".
Save the script and close Notepad. Now that you've written your own first AutoIt script! To run this script you simply double-click the helloworld.au3 file (or you can right-click the script and choose Run Scriptin the menu).
You should see a message box like this:
Now let's look at the identification of this parameter in the MsgBox function. We see a number of values listed in the Guide page of this function that are used to change the display style of the information box. A value of 0 displays a concise information box with a single OK button. If the value is, a message box with an exclamation point icon appears.
Open the script again to edit, and change the argument from 0 to 64:
MsgBox (64, "Guide", "Hello world!")
This message box appears when you run the script:
You can experiment on your own to see what happens when you set different values for the identity parameters. Keep in mind that if you need to apply more than one identity value, just add those values together.