Skip to main content

Worked recipes

Each recipe is a complete list of steps. Give the action a trigger on the Actions page, then build the steps as shown. Every recipe works in Simple and Advanced mode alike (Adding and arranging steps).

Before you give a recipe a real trigger, you can try it on the Sandbox page.

Close the current tab​

1Send keys^W
  1. Send keys presses Ctrl+W, which closes the current tab in browsers and most tabbed programs. Click the Keys box and press the combination.

The keys go to the window that has the focus. For a gesture drawn over a window in the background, turn on Activate the window under the gesture on the General page (General settings), so the keys reach the window you drew over.

Type a signature​

1Type textBest regards, Alex
  1. Type text types the text where the cursor is, as if you typed it.

For longer text, or text with line breaks, a typed shortcut on the Text expansion page is often simpler.

Move a window to the next screen​

1Move window to monitorTarget window, On
  1. Move window to monitor (the Move window chip) moves the window to the next screen, keeping its size and its place on the screen. Window is Target window: the window you drew the gesture over. Turn on Move the mouse with it to take the pointer along.

Screens are taken left to right, then top to bottom, and the last one wraps to the first. A maximized window stays maximized.

Maximize or restore the window under the gesture​

Quick create… offers this action ready-made as Maximize or restore the window.

1Target window→ $windowContextGetWindow
2IfWindowIsMaximized($window)
3Restore window$windowWindowRestore
4Otherwise
5Maximize window$windowWindowMaximize
6End if
  1. Target window (ContextGetWindow) with Save result as window keeps the window under the gesture.
  2. If… otherwise…, with Check set to A builtin's result and the builtin Is window maximized (WindowIsMaximized), its Window field $window.
  3. Inside the If part, Restore window with Window $window restores the window.
  4. Inside the Otherwise part, Maximize window with Window $window maximizes it.

Saving the window in step 1 is optional: each Window field could be Target window instead. Saving it once makes each later step's field shorter to read.

If the window is Notepad, save; otherwise say so​

1IfWindowContainsTitle(ContextGetWindow(), Notepad)
2Send keys^S
3Otherwise
4Show a notificationNot saved, This only works in Notepad.
5End if
  1. If… otherwise…, Check set to A builtin's result, builtin Title contains text (WindowContainsTitle): Window is Target window, Text is Notepad. It is true when the window's title contains "Notepad", in any upper and lower case.
  2. Inside the If part, Send keys presses Ctrl+S.
  3. Inside the Otherwise part, Show a notification shows a Title and a Message.

To test the program instead of the title, save the result of Program file name (WindowGetExecutableName) and compare it with Compare two values. That comparison is exact, so match the file name's upper and lower case as Windows reports it.

Media keys​

Send keys can't press media keys, so this recipe uses the KeyboardPressKey builtin, which presses any key by its name.

1Press and release keyVirtualKey.MediaPlayPauseKeyboardPressKey
  1. Press and release key (KeyboardPressKey, from All N builtins…) with Key VirtualKey.MediaPlayPause presses Play/Pause.

Use one action per key:

KeyKey name
Play/PauseVirtualKey.MediaPlayPause
Next trackVirtualKey.MediaNextTrack
Previous trackVirtualKey.MediaPreviousTrack
StopVirtualKey.MediaStop
Volume upVirtualKey.VolumeUp
Volume downVirtualKey.VolumeDown
MuteVirtualKey.VolumeMute

Type the name exactly, with the same capitals. Every key's name is listed under Named constants.

With Send media and browser keys as commands on, these keys are sent as commands to the window with the focus instead (Script settings).

Paste as plain text​

Quick create… offers this action ready-made as Paste as plain text.

1Clipboard text→ $textClipboardGetText
2Paste text$textClipboardPasteReplacementText
  1. Clipboard text with Save result as text reads the copied text without its formatting.
  2. Paste text with Text $text puts that plain text on the clipboard and pastes it.

Ask before closing a window​

1Show a message boxClose this window?, Close, YesNo, Question → $answerUIShowMessageBox
2If$answer == Yes
3Close windowTarget windowWindowClose
4End if
  1. Show a message box (UIShowMessageBox) shows a message box and waits. Message Close this window?, Title Close, Buttons YesNo, Icon Question, Save result as answer. It gives the name of the button pressed.
  2. If…, Check set to Compare two values: Value $answer, is equal to (==), Compared with Yes.
  3. Inside the block, Close window with Window Target window asks the window to close, as its close button would.

Press a key several times​

1Repeat times5
2Send keys{DOWN}
3Wait50
4End repeat
  1. Repeat a number of times, Times 5.
  2. Inside it, Send keys presses Down.
  3. Wait 50 milliseconds gives the program time to keep up.

Open a program, or switch to it​

1Switch to or start a programnotepad.exeShellRunOrActivate
  1. Switch to or start a program (ShellRunOrActivate) with Program file name notepad.exe brings Notepad to the front if it is running, and starts it if not. .exe is optional: notepad works too. Arguments after the name, such as a file to open, are used only when the program has to be started. Running programs are matched by the file name of the first word, so a path that contains spaces and is followed by arguments goes in single quotes.

To always start a new copy, or to open a file, folder or web address, use Run or open (ShellRun) instead, or Quick create…'s Open a program, file or website.