AutoIt is a Windows automation tool that can be used to automate tasks on Windows. AutoIt provides its own scripting language however, it can be difficult to work with if you need to integrate Windows automation into an existing test suite.
Enter AutoIt JS.
AutoIt JS wraps the AutoItX3.dll library using Koffi to provide a simple to use interface for AutoIt. It allows you to take your existing JavaScript/TypeScript test suite powered by Playwright/Cypress/Puppeteer/etc. and automate Windows programs with ease.
Documentation for this project is generated by typedoc and can be found at https://kasimahmic.github.io/autoit-js/. As all the documentation is generated from the code, the documentation is also available inline in your editor for convenience.
You can use the new asynchronous API in async contexts like Playwright and Cypress tests to avoid blocking the event loop and slowing down your tests.
import { Init, Run, Send, WinClose, WinWaitActive, autoit } from '@ahmic/autoit-js';
autoit.load();
await Init();
await Run('notepad.exe');
await WinWaitActive('[CLASS:Notepad]');
await Send('Hello, World!');
await WinClose('[CLASS:Notepad]');
autoit.unload();
For simple scripting tasks, the synchronous API is the preferred way to use AutoIt JS.
import { InitSync, RunSync, SendSync, WinCloseSync, WinWaitActiveSync, autoit } from '@ahmic/autoit-js';
autoit.load();
InitSync();
RunSync('notepad.exe');
WinWaitActiveSync('[CLASS:Notepad]');
SendSync('Hello, World!');
WinCloseSync('[CLASS:Notepad]');
autoit.unload();