Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
3978243
chore: Add precommit hooks and commit helper
KasimAhmic Jul 30, 2025
f5f1a7d
feat: Implement invokeAsync method on AutoIt class
KasimAhmic Jul 30, 2025
55afab8
refactor: Remove application name from Logger output
KasimAhmic Jul 30, 2025
6fc8691
feat: Implement async variant of WinGetTitleByHandle
KasimAhmic Jul 30, 2025
8d267fb
feat: Implement async variant of AutoItSetOption
KasimAhmic Jul 31, 2025
c7c9ed2
feat: Implement async variant of ClipGet
KasimAhmic Jul 31, 2025
bebda9c
feat: Implement async variant of ClipPut
KasimAhmic Jul 31, 2025
5f09057
feat: Implement async variant of ControlClick
KasimAhmic Jul 31, 2025
ced6a82
feat: Implement async variant of ControlClickByHandle
KasimAhmic Jul 31, 2025
4179bae
feat: Implement async variant of ControlCommand
KasimAhmic Jul 31, 2025
3c861ac
feat: Implement async variant of ControlCommandByHandle
KasimAhmic Jul 31, 2025
055ffe4
feat: Implement async variant of ControlDisableByHandle
KasimAhmic Aug 1, 2025
90f91db
feat: Implement async variant of ControlDisable
KasimAhmic Aug 1, 2025
1799424
feat: Implement async variant of ControlEnable
KasimAhmic Aug 1, 2025
c73c830
feat: Implement async variant of ControlEnableByHandle
KasimAhmic Aug 1, 2025
8d8ea69
feat: Implement async variant of ControlFocus
KasimAhmic Aug 1, 2025
8c2108e
feat: Implement async variant of ControlFocusByHandle
KasimAhmic Aug 1, 2025
cd883a5
feat: Implement async variant of ControlGetFocus
KasimAhmic Aug 1, 2025
43d9ce0
feat: Implement async variant of ControlGetFocusByHandle
KasimAhmic Aug 1, 2025
1ba2f70
feat: Implement async variant of ControlGetHandle
KasimAhmic Aug 1, 2025
8fd4d83
feat: Implement async variant of ControlGetHandleAsText
KasimAhmic Aug 1, 2025
e8e2c1f
feat: Implement async variant of ControlGetPos
KasimAhmic Aug 1, 2025
fb81414
feat: Implement async variant of ControlGetPosByHandle
KasimAhmic Aug 1, 2025
8930b56
feat: Implement async variant of ControlGetText
KasimAhmic Aug 1, 2025
fa14d5b
feat: Implement async variant of ControlGetTextByHandle
KasimAhmic Aug 1, 2025
6e46752
feat: Implement async variant of ControlHide
KasimAhmic Aug 1, 2025
2263592
feat: Implement async variant of ControlHideByHandle
KasimAhmic Aug 1, 2025
571c99d
docs: Fix bad import
KasimAhmic Aug 1, 2025
e98da74
feat: Implement async variant of ControlListView
KasimAhmic Aug 1, 2025
7a2cdcb
feat: Implement async variant of ControlListViewByHandle
KasimAhmic Aug 1, 2025
f633c76
feat: Implement async variant of ControlMove
KasimAhmic Aug 1, 2025
8bfa87f
feat: Implement async variant of ControlMoveByHandle
KasimAhmic Aug 1, 2025
f250ce6
Merge branch 'async-implementation' of https://github.com/KasimAhmic/…
KasimAhmic Aug 1, 2025
37ccf2f
feat: Implement async variant of ControlSend
KasimAhmic Aug 4, 2025
5b9f2ee
feat: Implement async variant of ControlSetTextByHandle
KasimAhmic Aug 4, 2025
2c74679
feat: Implement async variant of ControlSendByHandle
KasimAhmic Aug 4, 2025
b42bd48
feat: Implement async variant of ControlSetText
KasimAhmic Aug 4, 2025
c0837aa
feat: Implement async variant of ControlShowByHandle
KasimAhmic Aug 4, 2025
a714e99
feat: Implement async variant of ControlShow
KasimAhmic Aug 4, 2025
b0dd5c1
feat: Implement async variant of ControlTreeViewByHandle
KasimAhmic Aug 4, 2025
1a0e391
feat: Implement async variant of ControlTreeView
KasimAhmic Aug 4, 2025
0fc9132
feat: Implement async variant of DriveMapAdd
KasimAhmic Aug 4, 2025
c7ee3d5
docs: Fix docs for DriveMapAdd
KasimAhmic Aug 4, 2025
6984528
docs: Fix docs for ControlTreeView
KasimAhmic Aug 4, 2025
8764745
feat: Implement async variant of DriveMapDel
KasimAhmic Aug 4, 2025
3ff7e12
feat: Implement async variant of DriveMapGet
KasimAhmic Aug 4, 2025
56791b4
feat: Implement async variant of error
KasimAhmic Aug 4, 2025
68775d3
feat: Implement async variant of Init
KasimAhmic Aug 4, 2025
9eee560
feat: Implement async variant of IsAdmin
KasimAhmic Aug 4, 2025
4cd2aa2
feat: Implement async variant of MouseClickDrag
KasimAhmic Aug 4, 2025
4237009
feat: Implement async variant of MouseClick
KasimAhmic Aug 4, 2025
6f185d6
feat: Implement async variant of MouseDown
KasimAhmic Aug 4, 2025
c99a061
docs: Update docs for MouseClickDrag
KasimAhmic Aug 4, 2025
192ec3a
docs: Update docs for MouseClick
KasimAhmic Aug 4, 2025
193349f
feat: Implement async variant of MouseGetCursor
KasimAhmic Aug 4, 2025
4cf09bd
feat: Implement async variant of MouseGetPos
KasimAhmic Aug 4, 2025
b003043
docs: Update docs for MouseGetCursor
KasimAhmic Aug 4, 2025
1c0cdd3
feat: Implement async variant of MouseMove
KasimAhmic Aug 4, 2025
d9a5920
feat: Implement async variant of MouseUp
KasimAhmic Aug 4, 2025
f555c95
feat: Implement async variant of MouseWheel
KasimAhmic Aug 4, 2025
9364c70
feat: Implement async variant of Opt
KasimAhmic Aug 4, 2025
a00778d
feat: Implement async variant of PixelChecksum
KasimAhmic Aug 4, 2025
87001be
feat: Implement async variant of PixelGetColor
KasimAhmic Aug 4, 2025
6fbf46b
feat: Implement async variant of PixelSearch
KasimAhmic Aug 4, 2025
dfee525
chore: Update README
KasimAhmic Aug 4, 2025
75a833f
chore: Update CONTRIBUTING
KasimAhmic Aug 4, 2025
be5b38d
feat: Implement async variant of ProcessClose
KasimAhmic Aug 5, 2025
fc692e2
feat: Implement async variant of ProcessExists
KasimAhmic Aug 5, 2025
6acfbd3
feat: Implement async variant of ProcessSetPriority
KasimAhmic Aug 5, 2025
7ae98d7
docs: Update ProcessExists documentation
KasimAhmic Aug 5, 2025
ea88b18
feat: Implement async variant of ProcessWaitClose
KasimAhmic Aug 5, 2025
4ad8378
feat: Implement async variant of ProcessWait
KasimAhmic Aug 5, 2025
5e7a824
feat: Implement async variant of RunAsWait
KasimAhmic Aug 5, 2025
a1b65b5
feat: Implement async variant of RunAs
KasimAhmic Aug 5, 2025
92f1bb2
feat: Implement async variant of RunWait
KasimAhmic Aug 5, 2025
89e43db
docs: Update RunAs documentation
KasimAhmic Aug 5, 2025
6191ab9
feat: Implement async variant of Run
KasimAhmic Aug 5, 2025
5289407
docs: Update RunWait documentation
KasimAhmic Aug 5, 2025
a96e5df
feat: Implement async variant of Send
KasimAhmic Aug 5, 2025
dad0ed3
feat: Implement async variant of Shutdown
KasimAhmic Aug 5, 2025
c84f96e
feat: Implement async variant of Sleep
KasimAhmic Aug 5, 2025
7167895
feat: Implement async variant of StatusbarGetTextByHandle
KasimAhmic Aug 5, 2025
c0e4a03
feat: Implement async variant of StatusbarGetText
KasimAhmic Aug 5, 2025
6dfb22f
feat: Implement async variant of Tooltip
KasimAhmic Aug 5, 2025
eef4de3
feat: Implement async variant of WinActivateByHandle
KasimAhmic Aug 6, 2025
0dca5a7
feat: Implement async variant of WinActivate
KasimAhmic Aug 6, 2025
644cd4a
feat: Implement async variant of WinActiveByHandle
KasimAhmic Aug 6, 2025
deab52a
feat: Implement async variant of WinActive
KasimAhmic Aug 6, 2025
08d03c5
feat: Implement async variant of WinCloseByHandle
KasimAhmic Aug 6, 2025
30f2513
feat: Implement async variant of WinClose
KasimAhmic Aug 6, 2025
c1973fc
feat: Implement async variant of WinExistsByHandle
KasimAhmic Aug 6, 2025
4fceea6
feat: Implement async variant of WinExists
KasimAhmic Aug 6, 2025
5c6914d
feat: Implement async variant of WinGetCaretPos
KasimAhmic Aug 6, 2025
0da5b73
feat: Implement async variant of WinGetClassListByHandle
KasimAhmic Aug 6, 2025
df0287f
feat: Implement async variant of WinGetClassList
KasimAhmic Aug 6, 2025
0b35373
feat: Implement async variant of WinGetClientSizeByHandle
KasimAhmic Aug 6, 2025
678b221
feat: Implement async variant of WinGetClientSize
KasimAhmic Aug 6, 2025
6ff9ffb
feat: Implement async variant of WinGetHandleAsText
KasimAhmic Aug 6, 2025
d85197a
feat: Implement async variant of WinGetHandle
KasimAhmic Aug 6, 2025
79e9406
feat: Implement async variant of WinGetPosByHandle
KasimAhmic Aug 6, 2025
c21445f
feat: Implement async variant of WinGetPos
KasimAhmic Aug 6, 2025
5d11c49
feat: Implement async variant of WinGetProcessByHandle
KasimAhmic Aug 6, 2025
1e88486
feat: Implement async variant of WinGetProcess
KasimAhmic Aug 6, 2025
edd7f35
feat: Implement async variant of WinGetStateByHandle
KasimAhmic Aug 6, 2025
c30797f
feat: Implement async variant of WinGetState
KasimAhmic Aug 6, 2025
6dba8e5
feat: Implement async variant of WinGetTextByHandle
KasimAhmic Aug 6, 2025
5b7911c
feat: Implement async variant of WinGetText
KasimAhmic Aug 6, 2025
1b6a4b8
feat: Implement async variant of WinGetTitle
KasimAhmic Aug 6, 2025
849d237
feat: Implement async variant of WinKillByHandle
KasimAhmic Aug 6, 2025
2512fb8
feat: Implement async variant of WinKill
KasimAhmic Aug 6, 2025
39d26d5
feat: Implement async variant of WinMenuSelectItemByHandle
KasimAhmic Aug 6, 2025
a1dd53f
feat: Implement async variant of WinMenuSelectItem
KasimAhmic Aug 6, 2025
d01678c
feat: Implement async variant of WinMinimizeAllUndo
KasimAhmic Aug 6, 2025
5e13124
feat: Implement async variant of WinMinimizeAll
KasimAhmic Aug 6, 2025
b1771e2
feat: Implement async variant of WinMoveByHandle
KasimAhmic Aug 6, 2025
4e7248a
feat: Implement async variant of WinMove
KasimAhmic Aug 6, 2025
a50d316
feat: Implement async variant of WinSetTitleByHandle
KasimAhmic Aug 6, 2025
94e2cb8
feat: Implement async variant of WinSetTitle
KasimAhmic Aug 6, 2025
3c5e26f
feat: Implement async variant of WinSetOnTopByHandle
KasimAhmic Aug 6, 2025
3c98b5c
feat: Implement async variant of WinSetOnTop
KasimAhmic Aug 6, 2025
602ac3e
feat: Implement async variant of WinSetStateByHandle
KasimAhmic Aug 6, 2025
fb7f4ae
feat: Implement async variant of WinSetState
KasimAhmic Aug 6, 2025
9fdb585
feat: Implement async variant of WinSetTransByHandle
KasimAhmic Aug 6, 2025
64f88aa
feat: Implement async variant of WinSetTrans
KasimAhmic Aug 6, 2025
b803df6
feat: Implement async variant of WinWaitActiveByHandle
KasimAhmic Aug 6, 2025
1539a2d
feat: Implement async variant of WinWaitActive
KasimAhmic Aug 6, 2025
3e33d33
feat: Implement async variant of WinWaitByHandle
KasimAhmic Aug 6, 2025
2d28fbd
feat: Implement async variant of WinWaitCloseByHandle
KasimAhmic Aug 6, 2025
f314af8
feat: Implement async variant of WinWaitClose
KasimAhmic Aug 6, 2025
50e051f
feat: Implement async variant of WinWaitNotActiveByHandle
KasimAhmic Aug 6, 2025
60b8eb9
feat: Implement async variant of WinWaitNotActive
KasimAhmic Aug 6, 2025
da9a963
feat: Implement async variant of WinWait
KasimAhmic Aug 6, 2025
3f6e86c
refactor: Update WinGetClientSizeByHandleSync return type
KasimAhmic Aug 7, 2025
0b822db
docs: Update WinKillByHandle docs
KasimAhmic Aug 7, 2025
2929195
docs: Update Basic Usage doc
KasimAhmic Aug 8, 2025
5c45794
chore: Upgrade all dependencies
KasimAhmic Aug 8, 2025
b2b1f8c
test: Use sync API in unit tests
KasimAhmic Aug 8, 2025
e7dcdea
refactor: Update return types and docs
KasimAhmic Aug 8, 2025
5113221
chore: Add last even text to TestApp
KasimAhmic Aug 9, 2025
cc62be5
fix: Fix TOOLINFOW struct
KasimAhmic Aug 9, 2025
b265c49
test: Update TestApp pre-built binary
KasimAhmic Aug 9, 2025
553b309
test: Update and overhaul tests
KasimAhmic Aug 9, 2025
27b8b1b
test: Update test suite names
KasimAhmic Aug 9, 2025
7d8f22d
test: Add test for typedPromisify and disable AutoIt tests on non-Win…
KasimAhmic Aug 9, 2025
5b01275
docs: Fix typo in Tooltip
KasimAhmic Aug 9, 2025
8fe10d4
docs: Fix typos in docs
KasimAhmic Aug 9, 2025
c32fb88
ci: Add JSDoc comments in the d.ts files
KasimAhmic Aug 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm run lint-staged
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ When reporting bugs, please include the following:
Example bug report:

Title: PixelSearch coordinates are offset by the horizontal resolution

Description: When using PixelSearch, the coordinates are offset by the horizontal resolution of the screen.
For example, if I search for a blue pixel located at (700, 500), the function returns (2620, 500) on a
1920x1080 screen.

Code:

```typescript
Expand Down
45 changes: 36 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AutoIt JS

Node.js bindings for AutoItX3.dll.

<div align="center">

Node.js bindings for AutoItX3.dll.

![NPM Version](https://img.shields.io/npm/v/%40ahmic%2Fautoit-js)
![GitHub License](https://img.shields.io/github/license/KasimAhmic/autoit-js)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/KasimAhmic/autoit-js/build.yml)
Expand All @@ -15,24 +15,51 @@ Node.js bindings for AutoItX3.dll.

## What is AutoIt JS?

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.
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](https://koffi.dev/) 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.
AutoIt JS wraps the AutoItX3.dll library using [Koffi](https://koffi.dev/) 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.

## Example Usage

### New Asynchronous API in v2

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.

```typescript
import { Init, Run, Send, WinClose, WinWaitActive, autoit } from '@ahmic/autoit-js';

autoit.load();

Init();
Run('notepad.exe');
WinWaitActive('[CLASS:Notepad]');
Send('Hello, World!');
WinClose('[CLASS:Notepad]');
await Init();
await Run('notepad.exe');
await WinWaitActive('[CLASS:Notepad]');
await Send('Hello, World!');
await WinClose('[CLASS:Notepad]');

autoit.unload();
```

### Synchronous API

For simple scripting tasks, the synchronous API is the preferred way to use AutoIt JS.

```typescript
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();
```
2 changes: 1 addition & 1 deletion TestApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.28)
project(TestApp)
enable_language(RC)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)

set(RESOURCES "src/resources/TestApp.rc")

Expand Down
1 change: 1 addition & 0 deletions TestApp/src/include/handles.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ inline HWND cancelButtonHandle;
inline HWND treeListViewHandle;
inline HWND listViewHandle;
inline HWND statusBarHandle;
inline HWND eventHandle;
inline HFONT fontHandle;
inline HBRUSH brushHandle;
20 changes: 20 additions & 0 deletions TestApp/src/include/util.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <format>
#include <memory>
#include <iostream>

Expand Down Expand Up @@ -251,3 +252,22 @@ inline VOID SetTheme(HWND handle) {
logger->warn("Failed to set theme on window. Reason: " + result);
}
}

inline VOID UpdateLastEvent(UINT event, WPARAM wParam) {
const std::wstring name = [&] {
switch (event) {
case WM_MOUSEMOVE: return std::wstring(L"Mouse Move");
case WM_LBUTTONDOWN: return std::wstring(L"Mouse Left Click");
case WM_RBUTTONDOWN: return std::wstring(L"Mouse Right Click");
case WM_LBUTTONDBLCLK: return std::wstring(L"Mouse Left Double Click");
case WM_RBUTTONDBLCLK: return std::wstring(L"Mouse Right Double Click");
case WM_MOUSEWHEEL: {
const wchar_t *dir = GET_WHEEL_DELTA_WPARAM(wParam) < 0 ? L"Down" : L"Up";
return std::format(L"Mouse Wheel {}", dir);
}
default: return std::wstring();
}
}();

SetWindowTextW(eventHandle, std::format(L"Last Event: {}", name).c_str());
}
33 changes: 27 additions & 6 deletions TestApp/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ LRESULT CALLBACK WndProc(HWND windowHandle, const UINT message, const WPARAM wPa
FORM_INPUT_WIDTH,
30);

CreateCheckBox(
HWND checkBoxThree = CreateCheckBox(
windowHandle,
L"Check Box 3",
PADDING,
Expand Down Expand Up @@ -293,6 +293,14 @@ LRESULT CALLBACK WndProc(HWND windowHandle, const UINT message, const WPARAM wPa
155,
MAX_CLIENT_HEIGHT - GetRectRelativeToParent(listViewHandle, windowHandle).bottom);

eventHandle = CreateStaticText(
windowHandle,
L"Last Event: ",
GetRectRelativeToParent(checkBoxOne, windowHandle).left,
GetRectRelativeToParent(checkBoxThree, windowHandle).bottom + PADDING + 5,
300,
20);

statusBarHandle = CreateWindowEx(
0,
STATUSCLASSNAME,
Expand All @@ -315,9 +323,9 @@ LRESULT CALLBACK WndProc(HWND windowHandle, const UINT message, const WPARAM wPa

SetTheme(listViewHandle);
SetTheme(treeListViewHandle);
}

break;
break;
}

case WM_COMMAND: {
switch (LOWORD(wParam)) {
Expand All @@ -340,8 +348,19 @@ LRESULT CALLBACK WndProc(HWND windowHandle, const UINT message, const WPARAM wPa
default:
return DefWindowProc(windowHandle, message, wParam, lParam);
}

break;
}

case WM_MOUSEMOVE:
case WM_LBUTTONDOWN:
case WM_RBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
case WM_MOUSEWHEEL: {
UpdateLastEvent(message, wParam);
break;
}
break;

case WM_PAINT: {
PAINTSTRUCT ps;
Expand Down Expand Up @@ -400,12 +419,14 @@ LRESULT CALLBACK WndProc(HWND windowHandle, const UINT message, const WPARAM wPa
break;
}

case WM_DESTROY:
case WM_DESTROY: {
PostQuitMessage(0);
break;
}

default:
default: {
return DefWindowProc(windowHandle, message, wParam, lParam);
}
}
return 0;
}
Expand Down
Binary file modified bin/TestApp.exe
Binary file not shown.
76 changes: 67 additions & 9 deletions docs/Basic Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,64 @@

Using AutoIt JS is as straightforward as it gets; import function, call function, use result.

## Synchronous Example

You can use the synchronous API for simple scripting tasks if you don't want to deal with promises.

```typescript
import {
ControlClickByHandleSync,
ControlGetHandleSync,
InitSync,
RunSync,
SendSync,
WinCloseSync,
WinGetHandleSync,
WinWaitActiveSync,
WinWaitSync,
autoit,
} from '@ahmic/autoit-js';

// An instance of the AutoIt class is created automatically, you need only call load() to initialize it
autoit.load();

// Initialize AutoIt
InitSync();

// Run Notepad
RunSync('notepad.exe');

// Wait for Notepad to be active
WinWaitActiveSync('[CLASS:Notepad]');

// Type into Notepad
SendSync('Hello, World!');

// Close Notepad
WinCloseSync('[CLASS:Notepad]');

// Wait for the Save dialog to appear
WinWaitSync('Notepad', '&Save');

// Get the handle of the Save dialog
const dialogHandle = WinGetHandleSync('Notepad', '&Save');

// Get the handle of the Don't Save button
const buttonHandle = ControlGetHandleSync(dialogHandle, 'Button2');

// Click the Don't Save button
ControlClickByHandleSync(dialogHandle, buttonHandle);

// Unload AutoIt
autoit.unload();
```

## Asynchronous Example

When in asynchronous contexts like in Cypress and Playwright, you can use the asynchronous API to avoid
blocking the event loop. The API is largely the same except that you need to `await` the functions and use the
non `Sync` versions.

```typescript
import {
ControlClickByHandle,
Expand All @@ -20,31 +78,31 @@ import {
autoit.load();

// Initialize AutoIt
Init();
await Init();

// Run Notepad
Run('notepad.exe');
await Run('notepad.exe');

// Wait for Notepad to be active
WinWaitActive('[CLASS:Notepad]');
await WinWaitActive('[CLASS:Notepad]');

// Type into Notepad
Send('Hello, World!');
await Send('Hello, World!');

// Close Notepad
WinClose('[CLASS:Notepad]');
await WinClose('[CLASS:Notepad]');

// Wait for the Save dialog to appear
WinWait('Notepad', '&Save');
await WinWait('Notepad', '&Save');

// Get the handle of the Save dialog
const dialogHandle = WinGetHandle('Notepad', '&Save');
const dialogHandle = await WinGetHandle('Notepad', '&Save');

// Get the handle of the Don't Save button
const buttonHandle = ControlGetHandle(dialogHandle, 'Button2');
const buttonHandle = await ControlGetHandle(dialogHandle, 'Button2');

// Click the Don't Save button
ControlClickByHandle(dialogHandle, buttonHandle);
await ControlClickByHandle(dialogHandle, buttonHandle);

// Unload AutoIt
autoit.unload();
Expand Down
Loading