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.

Zoom with the right button and the wheel​

Two actions, each with a wheel trigger on the right button: Wheel up zooms in, Wheel down zooms out. Put them in the app group of the program you zoom, such as a PDF or comic reader.

1Send keys^{ADD}
  1. In the zoom-in action, Send keys presses Ctrl and the plus key on the number pad, the zoom-in shortcut of most programs, SumatraPDF among them. Click the Keys box and press the combination.
  2. The zoom-out action is the same with Ctrl and the minus key on the number pad.

Hold the right button over the program and turn the wheel: each tick zooms one step, and letting go opens no context menu. Some programs zoom with the plus and minus keys alone, MComix among them: for those, leave out Ctrl. If the program uses other shortcuts, set those instead.

Middle-click with the right and left buttons​

One action with a button chord trigger: Draw button Right button, Other button Left button. Put it in the app group of your browser, or in Global for every program.

1ClickMouse X position, Mouse Y position, MouseButton.Middle
  1. Click clicks the middle button where the pointer is. Set X to Mouse X position, Y to Mouse Y position and Mouse button to MouseButton.Middle.

Hold the right button over a link and click the left button: the browser opens the link in a new tab, as a middle click does, and no context menu opens. Click the left button again while you still hold the right one to open the next link under the pointer.

Use the side buttons as extra buttons​

Any mouse button turned on as a draw button works like the right button: a click on its own still does what it always did, and held, it turns the wheel or a second button into an action. Here, holding side button 1 and turning the wheel presses the arrow keys, and holding side button 2 and turning the wheel changes the volume.

  1. On the General page, turn on Side button 1 and Side button 2 under Draw buttons (General settings).

  2. Add four actions, in Global or in the app group of one program, each with a wheel trigger:

    ActionDraw buttonDirectionStep
    Up arrowSide button 1Wheel upSend keys, the Up arrow key
    Down arrowSide button 1Wheel downSend keys, the Down arrow key
    Volume upSide button 2Wheel upPress and release key, VirtualKey.VolumeUp
    Volume downSide button 2Wheel downPress and release key, VirtualKey.VolumeDown
1Send keys{UP}
  1. For Send keys, click the Keys box and press the arrow key. The volume keys are pressed as in Media keys.

Two side buttons together work as a button chord: Draw button Side button 1 with Other button Side button 2 runs when you hold side button 1 and click side button 2. Draw button Side button 2 with Other button Side button 1 is a different chord, so it can run a different action. The middle button works the same way once it is a draw button, for example to Shift-click by holding the middle button and clicking the left one.

A side button can also be held while you press a key: set Then press to A key (Hold a button, press a key). And two quick taps, side button 1 and then side button 2, can run an action of their own with a tap sequence trigger, once Tap sequences is on.

What changes once a button is a draw button:

  • Its own click still reaches the program, but when you let go of the button, not when you press it.
  • Holding it and moving the mouse draws a gesture, as with the right button. Holding it still for longer than the cancel timeout gives the press back to the program (Cancel timeout).
  • The middle button: a browser's scrolling by holding the middle button starts only once you have held it still for the cancel timeout, because moving draws a gesture instead.
  • In a program that needs the button untouched, such as a game, turn off Draw buttons start gestures here in its app group (Advanced mode, App groups), or add it to an ignore group.

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​

1IfWindowTitleContains(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 (WindowTitleContains): 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.