Compiling and running a script (Simple)

Create your first program (script) or function. Note that most functions belong to the functions' family for easier coding as Winxxx (Windows-related functions), Filexxx (file management related), and Inixxx (INI files related).

Getting ready

Open SciTE from AutoIt Program Group and start writing your source code.

How to do it...

Perform the following steps to compile and run your script:

  1. Write any function or command as:
    Msgbox(0,'Title','Hello')
  2. Press F5 to run.
  3. Press F7 to get an executable (.exe) file.
  4. Double-click or select Msgbox, and then press F1 for function help.

If you type ( after Msgbox, you will get an IntelliSense help tooltip for the active command/function.

I recommend you use and copy the samples of the provided help file (.chm) as templates.

How it works...

The keyboard keys used for compiling and running can be explained as follows:

  • F5: You get the output/input of this working app, for example, a message box
  • F7: You get a yourapp.exe file that you can run standalone anywhere

You can copy this file to other computers where you have no Autolt. Libraries are included inside the executable, which will use Windows' default libraries. If you want to share your source code, you may use the fileinstall() function and include the AU3 source file inside your executable so that you only distribute one app. Also, you may distribute using a ZIP (or SXF compressed) file as usual exe, source, and others, and decompress it into a portable application folder; you may also create shortcuts and icons when running it for the first time.

There's more...

From here you can write commands/functions and use script flow control:

  • If...Then
  • For...Next
  • While...WEnd

Conditional statements available in AutoIt can be found at http://www.autoitscript.com/autoit3/docs/intro/lang_conditional.htm.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset