460 likes | 901 Views
What is AutoIt ?. AutoIt is a scripting language The purpose of AutoIt is to automate tasks Only available in Windows Language syntax similar to that of Visual BASIC Provides extensive general scripting to manipulate and manage the Windows GUI.
E N D
What is AutoIt? • AutoIt is a scripting language • The purpose of AutoIt is to automate tasks • Only available in Windows • Language syntax similar to that of Visual BASIC • Provides extensive general scripting to manipulate and manage the Windows GUI
Creating , running and compiling a Script in AutoIt • Create a file with the .au3 extension • With AutoIt installed, right click on your file in Windows Explorer, and select Compile or Run • Compiled scripts are standalone .exe applications
Features and Limitations Does not Support • Threads • Instead, use a mechanism called Adlib, which runs periodically but not concurrently • Object oriented design • The Goto keyword • Type checking • Error handling Supports • Arrays • Functions • Conditional Logic • If… Then… Else • Select … Case • Switch … Case • Loops • For...Next • While...WEnd • Do...Until • For...In...Next • Pointers (called Handles) • Static Variables • Extensive String manipulations • Regular Expressions • Extensive GUIcreation/manipulation • COM support • Many libraries of User Defined Functions (UDFs)
Syntax - Comments • Line comments precede text with a ; • Block comments start with #cs or #comments-start and end with #ce or #comments-end directives
Syntax – Declaring Variables • Variables begin with $, may contain numbers, letters, or underscores _
Syntax – If statement • Conditional Statements and loops may be nested
Syntax – For Loop • Conditional Statements and loops may be nested
Datatypes • Single loosely typed datatype called Variant. • A variant can contain numeric, string or Boolean data and decides how to use the data depending on the situation it is being used in. For example, if you try to: • Multiplytwo variants they will be treated as numbers • Concatenate(join) two variants they will be treated as strings • Logical operations on two variants, they will be treated as Boolean.
Cool native functions of AutoIt • — Simulates a mouse click on a control to a specific x, y. (run->calc) • — Responds to a user pressing a specific key on the keyboard by executing a function (cd tray example) • — Get and put text from/to your clipboard (like ctrl+c and ctrl+c) • This is a clever way to get output and send input to a script
Typical example uses of AutoIt • Automate the task of installing Win-Rar • Creating a bot to play a game that requires certain action on different situations (like Diablo II, Snake, or text based RPG games) • Creating advanced keyboard or mouse macros • Automating specific tasks that would otherwise require manual execution (gcb) • Parse text on the fly using ClipGet (saves you a step of pasting it into another program)
A few example scripts from the AutoIt Forum • WebCamas BarCode Reader- Use your webcam to read barcodes. • Morse Code Generator- Generate morse code by tapping your spacebar! • Weather desktop widget - Standalone updating weather widget for desktop. • Obfuscator – Make your protected scripts harder to read. • Facebook Farmville automation – Script to automate playing Farmville. • 30 Day Trial– A sub-component that may be added to your script to control distribution of your script. • Mouse repel - Keep computer mouse away from an area.
History of AutoIt • AutoIt was created by Jonathan Bennett • Created for the purpose of reliably configuring thousands of new computers in 1999 • AutoIt was rewritten with community support to its current version, v3 • Now includes features such as: • Creating GUIs • Extensive String functions • Many Libraries of User Defined Functions (UDFs)
Here’s a little demonstration. • While I’m preparing the demo of PixelSearch and MouseMove, any questions?