Screenplay

Motivation

Screen casts are a popular way to demonstrate and teach new software. However, creating them can be tedious. Typically one needs to practice a couple of times before obtaining the desired result. Even then, it might happen that you do a wrong click, you forget some steps, or an OS message pops up, and you need to start over again.

Then with every software update that changes the software's user interface, screencasts should be be re-created, so that they are in sync with the current software version, to not confuse users, and to not feel outdated.

This is where Screenplay trys to help:

Example: Open a website

Start recording the primary screen.
Wait for 2 second(s).

// Click on the Firefox icon in the taskbar
Mouse click left at (512, 1062) on the Firefox icon.

// Wait until Firefox is open
Wait for window 'Mozilla Firefox'.

// Visit a website
Enter 'https://youtu.be/PKXRzivIRfM', <ENTER>.

Wait for 2 second(s).
Stop recording.

Making of

Below is a video that demonstrates how to use Screenplay to create the above screen recording. It also demonstrates Screenplay's autocompletion features, which

So overall, we have created a screen recording using Screenplay, showing how to create a screen recording using Screenplay.

Validating mouse coordinates

A key benefit of Screenplay is the ease with wich screen recordings can be re-created. This is particularly useful if the software illustrated in the recording has been updated with a new user interface.

Recorded cursor positions, however, will in general change over time, for various reasons: The icon arrangement in the taskbar might have changed because new programs have been installed, the screen resolution might have changed due to a new monitor, etc.

To address this, Screenplay features a validation mode. To invoke it, use Validate instead of Run from the Run menu. This runs the script (with increased speed, and without recording or speech), and stops right before executing any mouse pointer action, allowing the user to update its coordinates.

The video below demonstrates this, using the sample recording from above:

Commands

Mouse click <left | middle | right> at (<x>, <y>) <purpose>.
Moves the mouse to the specified screen coordinates and simulates a mouse click with the specified button. <purpose> is optional and specifies the purpose for the mouse click.
Mouse double-click <left | middle | right> at (<x>, <y>) <purpose>.
Moves the mouse to the specified screen coordinates and simulates a mouse double-click with the specified button. <purpose> is optional and specifies the purpose for the mouse click.
Mouse press <left | middle | right> at (<x>, <y>) <purpose>.
Moves the mouse to the specified screen coordinates and simulates a mouse press event with the specified button. <purpose> is optional and specifies the purpose for the mouse press.
Mouse release <left | middle | right> at (<x>, <y>) <purpose>.
Moves the mouse to the specified screen coordinates and simulates a mouse release event with the specified button. <purpose> is optional and specifies the purpose for the mouse release.
Mouse move to (<x>, <y>) <purpose>.
Moves the mouse to the specified screen coordinates. <purpose> is optional and specifies the purpose for the mouse move.
Mouse move along coordinates (<x1>, <y1>), (<x2>, <y2>), ..., (<xn>, <yn>).
Moves the mouse along a smooth curve through the specified screen coordinates.
Mouse drag <left | middle | right> along coordinates (<x1>, <y1>), (<x2>, <y2>), ..., (<xn>, <yn>).
Drags the mouse along a smooth curve through the specified screen coordinates, keeping the specified mouse button pressed.
Mouse scroll by <n> tick(s).
Simulates a mouse scroll event by the specified number of ticks.
Enter ['text1' | <keystroke1>], ['text2' | <keystroke2>], ... .
Enters either a text (enclosed in single quotes) or a keystroke, or a mixed sequence of both. Keystrokes will also be shown visually.
Press key <keystroke>.
Simulates a key press event.
Release key <keystroke>.
Simulates a key release event.
// <comment>
A line starting with // represents a script comment and will be ignored during execution.
[message]

Text surrounded by [ and ] is interpreted as a message and will be shown on screen, while execution is paused, for 70 milliseconds per character.

The appearance of messages can be configured using the Messages menu.

Messages can span multiple lines; line breaks will be preserved.

Pause.
Pauses execution for 1 second.
Wait for <n> second(s).
Pauses execution for n second.
Wait for window 'window-title'.
Waits, if necessary, for a window with the specified title, and activates it.
Position the window 'window-title' <width> x <height> at (<x>, <y>).
Arranges the window with the specified title at the given position and resizes it to the given dimensions.
Activate the window 'window-title'.
Activates the window with the specified title, i.e. brings it into foreground so that it receives user input.
Set the state of the window 'window-title' to [normal | maximized | minimized].
Maximizes or minimizes the window with the specified title, or restores its normal size.
Speak "text-to-speak-out-loud".
Speaks the given text, enclosed in quotation marks, out loudly, using MS Windows speech synthesis.
Start recording [screen <n> | the primary screen | area <width> x <height> at (<x>, <y>) | window 'window-title'].

Starts screen recording, using FFmpeg. For this to work, FFmpeg must be installed and its executable must be in the PATH.

The screen area to record can be specified as
  • a particular screen, identified by its number (starting with 0)
  • the primary screen
  • an arbitrary rectangular screen area, specified by its position and dimensions
  • the area of the specified window
Stop recording.

Stops screen recording and opens the recorded video in the system video player.

Special requirements