rb.clipboard or process= targeting, which vary by platform, or mouse
movement, which needs hardware mode; see Platforms.
Text expansion
Type an abbreviation, press the expand key, and the abbreviation is replaced by its expansion.rb.hid.type types the whole string, capitals, symbols, and line
breaks included. To type through the operating system instead, whatever the
transport, use rb.system.type_text (see system).
input_down observer, so it never takes
exclusive capture of the keyboard, and claims only the expand key with
rb.bind. Add entries to snippets, and add any character an abbreviation
uses to unshifted or shifted.
Per-app shortcuts
A modeline scopes a script to applications by process name (process=) or
window title (window=). The same key does one thing in your editor and
nothing anywhere else, with no profile switching. The script’s binds are
inactive while no target window is focused.
process= to cover several apps (process=Code.exe process=Cursor.exe).
On macOS the process is the app’s name. Every targeting key is in the
modeline reference.
A second keyboard as a macro pad
A spare numpad, keyboard, or macro pad can run shortcuts while your main keyboard keeps typing normally. This needs hardware mode, where Rebind can tell devices apart. Attach the spare device in Peripherals and give it the nicknamepad; see Attach your devices.
device = PAD answers only to the pad, so the numpad on your
main keyboard still types digits. hardware_only=true keeps the script from
loading in software mode, where device binds never fire. Binding the same key
both per device and for every device follows an order; see
bind.
Clipboard transform
Copy the selection, transform the text in Luau, and paste the result. This one trims whitespace and lowercases it. Any string operation works in its place.cleaned line with your own transform. The rb.sleep(80) gives the
app time to fill the clipboard after the copy; raise it if the old contents come
back. rb.clipboard.get returns nil for an empty or non-text clipboard.
Multi-step macro
Replay a fixed keystroke sequence on demand.rb.run runs the sequence as a
coroutine, where rb.sleep waits between steps, and the returned handle stops
it partway.
rb.run to define the sequence. Each rb.sleep delay, in
milliseconds, is a minimum, not an exact time.
Record and replay a macro
rb.macro.record starts capturing keys and mouse movement, rb.macro.finish
returns the recorded actions with their delays, and rb.macro.play replays
them at a chosen speed.
speed divides the recorded delays: 100 keeps them, 200 halves them. Pass
{ ignore_mouse = true } to rb.macro.record to record keys only. To keep a
take, rb.macro.to_script(take, name) returns it in the format the app’s
recorder saves; see Macro files. The
transforms that rescale or resample a take are under
math.
Scroll to zoom
Hold a key and scroll to zoom: the script sends the wheel with Ctrl held, the zoom gesture in most browsers, editors, and image viewers on Windows."LWin" in place of
"LCtrl".
Mouse acceleration
A speed-dependent curve: slow movement stays close to 1:1 for precision, fast movement is multiplied so you cross the screen with less travel. The script rescales each movement in amove handler with mouse_block=true, which needs
hardware mode on every platform.
curve sets how fast the gain ramps once a movement passes threshold.
multiplier caps the gain on the fastest movement, and sensitivity scales
everything, slow movement included. The script keeps the fractional part of
each scaled movement and adds it to the next one, so slow, sub-pixel motion
still arrives.