AutoIt is a BASIC-like scripting language designed for automating the Windows GUI and general scripting. AutoIt scripts can be used to automate mouse clicks and keyboard presses and have those clicks and presses sent to applications being run as a Windows service under FireDaemon Pro control. AutoIt scripts are typically launched via FireDaemon Pro's event system as part of the Windows service's or application's lifecycle. You might develop these scripts to automatically login or look for and close specific popups that might be emitted by your application being run under FireDaemon Pro control.


This guide shows a simple example of how to run notepad.exe as a Windows service then launch an AutoIt script as part of the service lifecycle, that appends to text to Notepad, interacts with Notepad's menu system - popping up and closing a dialog box and then quitting out of Notepad.


Precautions

Interactive services running under FireDaemon Pro control run on Session 0. Please refer to our comprehensive notes on Session 0 to understand exactly what it is and how it works. Additionally, many AutoIt functions don't work as advertised when run on Session 0. These functions are noted in the AutoIt script found at the end of this guide.


Step 1: Install AutoIt

Download and install the latest version of AutoIt from the AutoIt website.


Step 2: Install FireDaemon Pro

Download and install the latest version of FireDaemon Pro from the FireDaemon website.


Step 3: Prepare and Stage Your AutoIt Script

For the sake of simplicity we have prepared a pre-canned AutoIt script (notepad.au3). You can download this script at the end of this guide. Please review the script in detail in order to understand what it does exactly. Once you have downloaded this script please copy it to an easily accessible folder(eg. C:\Temp). The FireDaemon Pro service that we setup next will need to reference the script.


Step 4: Setup Your FireDaemon Pro Service

Start FireDaemon Pro and click on the "Create a new service definition" button in the toolbar (or simply type Ctrl+N). Then enter the informtation into the fields as you see below. This service will quite simply run Notepad.exe as a Windows Service under FireDaemon Pro control.



Now click on the Pre / Post-Service tab. You will see the following. Click on the Pre-Service Insert button.



You will now the see Pre-Service Program Information dialog. Fill it out exactly as you see below then click OK. Configuring a Pre-Service event in this way will cause the AutoIt script to be executed after the service has started (ie. "After Event"). The AutoIt script is given at least 30 seconds to run (30000 milliseconds). This is very important as FireDaemon Pro will terminate the execution of the AutoIt script if it continues to run beyond 30 seconds. Note the path and name of the AutoIt script - this needs to match your setup.



After clicking OK, you should now see the following. Click OK to install and start the service.



Step 5: Watch the AutoIt Script In Action

Once you have installed the service, you should see it running in the main FireDaemon Pro window. You will now need to switch desktop to Session 0 in order to see Notepad being run and interacted with. Below is a short video showing the service running under FireDaemon Pro control on Windows 10. We then switch to Session 0 and can see Notepad being "automated". Eventually we switch back from Session 0 to our interactive desktop.