Procedure to run AutoIt script using ant (build.xml) tool.

In this post I will cover the procedure of AutoIT script execution with the help of ant build tool. As we know ant has java based library. But here I have set AutoIT compiler with Ant's build.xml file and can execute AutoIT scripts
  1. Ant path must be set in to system environment variable.
  2. AutoIT installation directory path must be set in to system environment variable.
    Below is a sample build.xml file for AutoIT script execution.

<?xml version="1.0"?>
<project name="Sample AutoIT  Project" default="MyTest" basedir=".">
     
      <target name="MyTest" depends="CreateLog">     
            <echo message="Execution started of ScriptName"/>          
            <exec dir="." executable="cmd" failonerror="true">
                  <arg line="/c AutoIt3.exe ScriptName.au3"/>
            </exec>                
      </target>        
     
</project>

Where “ScriptName” is your AutoIT script.

2 comments:

  1. Thanks for the blog. Its helped me in a lot.

    ReplyDelete
  2. Hi I would like to fail the ant build, if any error in autoit script. So can I do that ? Ex: if winexits returns false, i want to fail the build but continue with the script.

    Any suggestions?

    ReplyDelete

Leave your comments, queries, suggestion I will try to provide solution