Skip to content

Commit 71d1851

Browse files
authored
Merge pull request #7 from KasimAhmic/Add-documentation
Add documentation
2 parents 5aae394 + 882c1d7 commit 71d1851

File tree

127 files changed

+3393
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+3393
-71
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717

1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v4
2121

2222
- name: Setup Node ${{ matrix.node-version }}
23-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v4
2424
with:
2525
node-version: ${{ matrix.node-version }}
2626
cache: 'npm'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,5 @@ x86/
153153
*.user
154154
*.VC.db
155155
*.VC.opendb
156+
157+
.docs

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
# AutoIt JS
22

3-
Node.js bindings for AutoItX3.dll
3+
Node.js bindings for AutoItX3.dll.
44

5-
## Project Status
5+
<div align="center">
66

7-
> [!WARNING]
8-
> This project is currently in **beta** and is **mostly ready** for production use. There may be some undiscovered bugs hiding out somewhere and there are a few functions that need some additional work.
7+
![NPM Version](https://img.shields.io/npm/v/%40ahmic%2Fautoit-js)
8+
![GitHub License](https://img.shields.io/github/license/KasimAhmic/autoit-js)
9+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/KasimAhmic/autoit-js/build.yml)
10+
![NPM Downloads](https://img.shields.io/npm/dw/%40ahmic%2Fautoit-js)
11+
![GitHub Issues](https://img.shields.io/github/issues/KasimAhmic/autoit-js)
12+
![GitHub Pull Requests](https://img.shields.io/github/issues-pr/KasimAhmic/autoit-js)
913

10-
This library is not yet available on NPM, but it will be soon.
14+
</div>
1115

1216
## What is AutoIt JS?
1317

14-
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 Winodws automation into an existing test suite.
18+
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.
1519

1620
Enter AutoIt JS.
1721

18-
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.
22+
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.
1923

2024
## Example Usage
2125

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

2529
autoit.load();
2630

docs/Basic Usage.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Basic Usage
2+
3+
Using AutoIt JS is as straightforward as it gets; import function, call function, use result.
4+
5+
```typescript
6+
import {
7+
ControlClickByHandle,
8+
ControlGetHandle,
9+
Init,
10+
Run,
11+
Send,
12+
WinClose,
13+
WinGetHandle,
14+
WinWait,
15+
WinWaitActive,
16+
autoit,
17+
} from '@ahmic/autoit-js';
18+
19+
// An instance of the AutoIt class is created automatically, you need only call load() to initialize it
20+
autoit.load();
21+
22+
// Initialize AutoIt
23+
Init();
24+
25+
// Run Notepad
26+
Run('notepad.exe');
27+
28+
// Wait for Notepad to be active
29+
WinWaitActive('[CLASS:Notepad]');
30+
31+
// Type into Notepad
32+
Send('Hello, World!');
33+
34+
// Close Notepad
35+
WinClose('[CLASS:Notepad]');
36+
37+
// Wait for the Save dialog to appear
38+
WinWait('Notepad', '&Save');
39+
40+
// Get the handle of the Save dialog
41+
const dialogHandle = WinGetHandle('Notepad', '&Save');
42+
43+
// Get the handle of the Don't Save button
44+
const buttonHandle = ControlGetHandle(dialogHandle, 'Button2');
45+
46+
// Click the Don't Save button
47+
ControlClickByHandle(dialogHandle, buttonHandle);
48+
49+
// Unload AutoIt
50+
autoit.unload();
51+
```

0 commit comments

Comments
 (0)