AutoIt logo


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.


An AutoIt script can be run as a Windows service using FireDaemon Pro. This allows you to start and run the application automatically when Windows boots and before login. FireDaemon Pro also allows you to start multiple instances of the application, monitoring them and automatically restarting those instances in the event they crash. FireDaemon Fusion can also be used to manage your AutoIt service, plus other Windows services via your web browser.


AutoIt Setup Under FireDaemon Pro

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.


Step 1: Download and Install AutoIt

  1. Download from here. Make sure you get the latest release. For the purposes of this guide we will use the EXE installer. Keep all defaults during installation to avoid future issues.
  2. Create a folder to store your AutoIt script. For the purposes of this guide, we will use "C:\AutoIt Scripts". Download the example script at the bottom of this guide.

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 function


Step 2: Set Up AutoIt as a FireDaemon Pro Service

Download and install FireDaemon Pro. Double click the FireDaemon Pro icon on your desktop, then click on the New (i.e. +) button in the toolbar (or type Ctrl + N) to create a new service.:


FireDaemon Pro Example Service Program Tab


Now click on the Events tab. Append a new Launch Event. This is where we set up your service to stop run the provided AutoIt script.


FireDaemon Pro AutoIt events settings

Fill it out exactly as you see abpve then click OK. Configuring a Launch event in this way will cause the AutoIt script to be executed after the service has started (ie. "After Program Launch"). 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.

Lastly, click the Save and Close (ie. the tick) button on the toolbar. If the service's Startup Type is set to Automatic or Automatic (Delayed-Start), it will start immediately.


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 gif showing the service running under FireDaemon Pro control on Windows 2019. We then switch to Session 0 and can see Notepad being "automated". In Windows Server 2019, you will automatically be taken back to the login screen after 30 seconds.