Core Concepts
/

Actions

`key(name, modifiers)`

Will press, then release the given key or keystroke

`name`: String

`modifiers`: String ^optional^

Example

```

@key 'h', 'command shift'

``

Details

See key names and modifiers

`string(text)`

Will type the given text onto the screen

`text`: String

Example

```

@string('hello world')

``

Details

The text to type can include in the letter, number, or symbol, as well as tab and return characters (`\t`, and `\n`)

`keyDown(name, modifiers)`

Will perform a key-down event, without releasing the key afterwards.

`name`: String

`modifiers`: String ^optional^

Example

```

@keyDown('space', 'shift')

``

`keyUp(name, modifiers)`

Will perform a key-up event, usefule after calling `keyDown`

`name`: String

`modifiers`: String ^optional^

Example

```

@keyUp('space', 'shift')

``

`click()`

Will perform a mouse left-click.

Example

```

@click()

``

Work in progress...

Here's the rest of the api methods available, full docs coming soon

```

@doubleClick()

@tripleClick()

@rightClick()

@shiftClick()

@commandClick()

@optionClick()

@mouseDown()

@mouseUp()

@clickAtPosition({x, y}) clicks at another position without moving the mouse from its current position

@doubleClickAtPosition({x, y}) # double clicks at another position without moving the mouse from its current position

@rightClickAtPosition({x, y}) # right-clicks at another position without moving the mouse from its current position

@shiftClickAtPosition({x, y}) # shift-clicks at another position without moving the mouse from its current position

@commandClickAtPosition({x, y}) # command-clicks at another position without moving the mouse from its current position

@moveMouseAndReturn({x, y}, callback) # move mouse to a position, executes an action, then moves the mouse back to its original position

@positionMouse(x, y, screenIndex) # move the mouse to x y coordinates. If using multiple monitors, add screenIndex

@previousMouseLocation(index) # returns a previous location the mouse has paused: (index of 1 means the previous location, 2 would be the location before that, etc.)

@scrollUp(distance)

@scrollDown(distance)

@scrollLeft(distance)

@scrollRight(distance)

@do("commandName", simulatedInput) # runs another command as if it was spoken

@applescript('some applescript to execute')

@openMenuBarItem('item name')

@openMenuBarPath(['file', 'share', 'messages']) # for clicking items nested in menus / submenus

@openApplication('App Name')

@openBrowser() # opens your default browser

@openURL('http://example.com')

@inBrowser() # returns true if the current application is a web browser (Chrome, Safari, Firefox, etc.)

@currentBrowserUrl() # returns the current url of the frontmost web browser window

@urlContains('google.com') # returns true if the current frontmost browser window's url contains this argument

@delay(ms) # use a delay if you need to wait for something to happen

@currentApplication() # returns the current foreground application

@revealFinderDirectory("~/Documents")

@setVolume(1-100)

@clickServiceItem('item name')

@getClipboard() # returns the current text stored in the clipboard

@setClipboard("someString") # push a certain value onto the system clipboard

@getScreenInfo() # returns screen dimensions and relevant info

@exec("pwd") # run a shell script synchronously (you can use the return value)

@runAtomCommand("commandName", options) # communicates directly to Atom to perform an action

@transformSelectedText("predefinedTransformFunction") # transforms the currently selected text in most applications

@isTextSelected() # determines whether text is currently selected in the frontmost application

@getSelectedText() # returns the currently selected text in the frontmost application

@canDetermineSelections() # determines if the current application allows us to know if text is selected or not

@waitForClipboard() # waits a certain amount of time after a copy operation to make sure the copied text is now in the clipboard

@notify("a message") # does a system notification with a message

@sublime() # returns an object used to interact with Sublime Text (It has it's own API)

@resolveSuperModifier() # resolves the modifier 'super' to one of [command|control] depending on the current application and operating system (for example if you are on a Mac, running a Windows VM, it should return the windows version)

@needsExplicitModifierPresses() # some applications need special attention to explicitly press modifiers keys instead of just setting OS flags on the key events.

@clickDelayRequired() # some applications take a while to respond to click events.

@copy()

@paste()

@cut()

@undo()

@redo()

@newTab()

@selectAll()

@save()

@switchApplication() # switches to the most recent previous application (command+tab on Mac, alt+tab on others)

@space() # inserts a space

@enter() # presses enter

@up(times=1) # presses the up arrow x times

@down(times=1) # presses the down arrow x times

@left(times=1) # presses the left arrow x times

@right(times=1) # presses the right arrow x times

``

Key Names

For the methods `key` `keyDown` and `keyUp`, they each take an argument of a 'key name', followed by an optional list of modifier keys.

Available key names (case-insensitive)

```

A

S

D

F

H

G

Z

X

C

V

B

Q

W

E

R

Y

T

O

U

I

P

L

J

K

N

M

Grave

KeypadDecimal

KeypadMultiply

KeypadPlus

KeypadClear

KeypadDivide

KeypadEnter

KeypadMinus

KeypadEquals

Keypad0

Keypad1

Keypad2

Keypad3

Keypad4

Keypad5

Keypad6

Keypad7

Keypad8

Keypad9

Return

\n

Tab

\t

Space

' ' (blank space)

Delete

Escape

Command

Shift

CapsLock

Option

Control

RightShift

RightOption

RightControl

Function

F17

VolumeUp

VolumeDown

Mute

F18

F19

F20

F5

F6

F7

F3

F8

F9

F11

F13

F16

F14

F10

F12

F15

Help

Home

PageUp

ForwardDelete

F4

End

F2

PageDown

F1

Left

Right

Down

Up

Backspace

Enter

1

2

3

4

5

6

=

9

7

-

8

0

]

[

'

;

\

,

/

.

`

<

>

{

}

)

(

!

|

:

&

%

?

*

~

@

$

^

+

#

_

#

"

``

Available modifier keys

```

command

shift

option

control

super

``