# autohotkey.js

> Make AutoHotKey Scripts In JavaScript

Latest version **1.1.13** (published 2018-03-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install autohotkey.js
pnpm add autohotkey.js
yarn add autohotkey.js
bun add autohotkey.js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.13 |
| Published | 2018-03-07 |
| First published | 2018-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 650.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | TheBrokenRail |
| Maintainers | thebrokenrail |
| Keywords | autohotkey |

## Links

- npm: https://www.npmjs.com/package/autohotkey.js
- Repository: https://github.com/TheBrokenRail/AutoHotKey.js
- Homepage: https://github.com/TheBrokenRail/AutoHotKey.js#readme
- Issues: https://github.com/TheBrokenRail/AutoHotKey.js/issues
- npm.io page: https://npm.io/package/autohotkey.js

## Recent versions

- 1.1.13 (latest) — 2018-03-07
- 1.1.12 — 2018-03-05
- 1.1.11 — 2018-03-04
- 1.1.10 — 2018-03-01
- 1.1.9 — 2018-02-20
- 1.1.8 — 2018-02-19
- 1.1.7 — 2018-02-19
- 1.1.6 — 2018-02-19
- 1.1.5 — 2018-02-19
- 1.1.4 — 2018-02-19
- 1.1.3 — 2018-02-19
- 1.1.2 — 2018-02-18
- 1.1.1 — 2018-02-18
- 1.1.0 — 2018-02-18
- 1.0.10 — 2018-02-17
- … 10 more at https://npm.io/package/autohotkey.js/versions

## README

# AutoHotKey.js
Make AutoHotKey Scripts In JavaScript

[![Greenkeeper badge](https://badges.greenkeeper.io/TheBrokenRail/AutoHotKey.js.svg)](https://greenkeeper.io/) [![Travis](https://img.shields.io/travis/TheBrokenRail/AutoHotKey.js.svg?style=flat-square)](https://travis-ci.org/TheBrokenRail/AutoHotKey.js) [![Codecov](https://img.shields.io/codecov/c/github/TheBrokenRail/AutoHotKey.js.svg?style=flat-square)](https://codecov.io/gh/TheBrokenRail/AutoHotKey.js) [![npm](https://img.shields.io/npm/dt/autohotkey.js.svg?style=flat-square)](https://www.npmjs.com/package/autohotkey.js) [![npm](https://img.shields.io/npm/v/autohotkey.js.svg?style=flat-square)](https://www.npmjs.com/package/autohotkey.js) [![node](https://img.shields.io/node/v/autohotkey.js.svg?style=flat-square)](https://www.npmjs.com/package/autohotkey.js) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/TheBrokenRail/AutoHotKey.js/issues)
### [Documentation](https://TheBrokenRail.github.io/AutoHotKey.js/doc)
### [Test Results](https://TheBrokenRail.github.io/AutoHotKey.js/mochawesome-report/mochawesome.html)
### [Coverage Report](https://TheBrokenRail.github.io/AutoHotKey.js/coverage/lcov-report/index.html)
## Examples

### Basic Script
```js
require('autohotkey.js').init('Name Of File');

on('^t', function () {
  send('Hi');
});
```

#### Which Outputs
```ahk
^t::
  Send, Hi
Return
```

### Basic Script With If Statement
```js
require('autohotkey.js').init('Name Of File');

on('^t', function () {
  If(winExist('"Untitled - Notepad"'), function () {
    send('Notepad Open');
  })
});
```

#### Which Outputs
```ahk
^t::
  if (winExist("Untitled - Notepad")) {
    Send, Notepad Open
  }
Return
```

### Basic Script With If/Else Statement
```js
require('autohotkey.js').init('Name Of File');

on('^t', function () {
  If(winExist('"Untitled - Notepad"'), function () {
    send('Notepad Open');
  }).Else(function () {
    send('Notepad Not Open');
  });
});
```

#### Which Outputs
```ahk
^t::
  if (winExist("Untitled - Notepad")) {
    Send, Notepad Open
  }
  else {
    Send, Notepad Not Open
  }
Return
```

### Basic Script With Variables
```js
require('autohotkey.js').init('Name Of File');

on('^t', function () {
  set('Variable', '"Untitled - Notepad"');
  If(winExist(get('Variable')), function () {
    send('Notepad Open');
  }).Else(function () {
    send('Notepad Not Open');
  });
  send(get('Variable').contents());
});
```

#### Which Outputs
```ahk
^t::
  Variable := "Untitled - Notepad"
  if (WinExist(Variable)) {
    Send, Notepad Open
  }
  else {
    Send, Notepad Not Open
  }
  Send, %Variable%
Return
```

#### Runing Functions

```js
get('Variable').get('Function').run('"Argrument"');
winExist(get('Variable').get('Function').runInline('"Argrument"'));
```

### Store Output Script In Variable
```js
const autohotkey = require('autohotkey.js');
var script = new autohotkey.Script();
autohotkey.init('Name Of File', script);

on('^t', function () {
  send('Hi');
});
```

#### Script Object
```js
Script {
  text: '^t::\n  Send, Hi\nReturn\n',
  name: 'Name Of File.ahk',
  getText: function () {...},
  setText: function (text) {...},
  getName: function () {...},
  setName: function (name) {...}
}
```

---
_Source: https://npm.io/package/autohotkey.js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
