# dialog

> Show alert dialogs using Node.

Latest version **0.3.1** (published 2017-08-08) · 0 weekly downloads

## Install

```sh
npm install dialog
pnpm add dialog
yarn add dialog
bun add dialog
```

Provides the command `show_dialog`.

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2017-08-08 |
| First published | 2012-06-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 60 |
| Author | Tomás Pollak |
| Maintainers | tomas |

## Links

- npm: https://www.npmjs.com/package/dialog
- Repository: https://github.com/tomas/dialog
- Homepage: https://github.com/tomas/dialog#readme
- Issues: https://github.com/tomas/dialog/issues
- npm.io page: https://npm.io/package/dialog

## Recent versions

- 0.3.1 (latest) — 2017-08-08
- 0.3.0 — 2017-06-09
- 0.2.0 — 2016-10-12
- 0.1.8 — 2013-01-19
- 0.1.7 — 2013-01-15
- 0.1.6 — 2013-01-15
- 0.1.5 — 2012-12-27
- 0.1.3 — 2012-12-24
- 0.1.2 — 2012-06-13
- 0.1.1 — 2012-06-13
- 0.1.0 — 2012-06-13

## README

Dialog
======

Simple wrapper around zenity, osascript and vbscript that lets you
show native alert dialogs on Linux, OSX and Windows, respectively.

Example
-----

``` js
var dialog = require('dialog');

dialog.info('Hello there');
```

Usage
-------
To show an error dialog:

``` js
dialog.err(msg, title, callback);
```

To show a generic info dialog:

``` js
dialog.info(msg, title, callback);

// example, setting title
dialog.info('Ground control to major Tom.', 'My app', function(exitCode) {
	if (exitCode == 0) console.log('User clicked OK');
})
```

To show a warning dialog:

``` js
dialog.warn(msg, title, callback);

// example, without setting title
dialog.warn('This computer will autoterminate itself in 5 seconds.', function(exitCode){
	if (exitCode == 1) console.log('User closed window');
})
```

`exitCode` indicates whether the user clicked the default (OK) button (value `0`), or if they closed the window or clicked the "No/Cancel" button (value `1`).

Both `title` and `callback` are optional. Default title shown is "Important".

Credits
-------
Written by Tomás Pollak, except for the MsgBox script which was written by
[StackOverflow user boflynn](http://stackoverflow.com/a/774197).

Copyright
---------
(c) 2012 Fork Ltd. MIT license.

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