Use autoit to write the first script (Hello World)

Source: Internet
Author: User

(Note: If you have installed the scite Editor, it will edit the script instead of the notepad that comes with the system .)

Open the folder where you want to create the script, right-click the folder, and selectNew /Autoit V3 script.

Name the script fileHelloworld. au3. Note that the extension should be. Au3 --This indicates that the file is an autoit V3 script.

We have already created a script file. Now we have to edit the script to provide the functions we need. InHelloworld. au3Right-click the script file and selectEdit script.

Next, we will use NotepadProgramTo open this script, you will see something like this:

What you seeCodeIt is only convenient to organize comments of scripts. It also prompts "options" for future use ". Each line of the Code starts with a semicolon, so it is interpreted as a script comment (that is, it will be ignored ), this is similar to the command line that is ignored by DOS in the batch processing file in DOS.

Now, let's tell autoit to display an information box, which can be implemented by the msgbox function.

Add the following content at the bottom of the Code:

Msgbox (0, "Guide", "Hello world! ")

All functions have parameters. The msgbox function has three parameters: ID, title, and information. The number in the ID is used to change the display style of the Information Box-Let's try it now0. Both the title and information areStringParameter -- to use a string in autoit, double quotation marks or single quotation marks must be attached to the text, that is, "this is some text" or 'this is some text.

Save the script and close notepad. Now you have written your first autoit script! To run this script, simply double-clickHelloworld. au3File (you can also right-click the script and selectRun script).

You should see the following information box:

Now let's study the msgbox FunctionIdentifierThis parameter. On the Function guide page, we can see that many values are listed, which are used to change the display style of the information box. If the value is0Only oneOKThe simple information box of the button. If the value is64An information box with an exclamation point icon is displayed.

Open the script again and edit the parameter from 0 to 64:

Msgbox (64, "Guide", "Hello world! ")

The following message box appears when you run the script:

You can perform a test on your own to see what the results will be if the value of the parameter is set differently. Remember, if you need to apply more than one id value, you only need to add those values.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.