Skip to main content

Input Text (sys.input_text)

Declaration

sys.input_text(text [, press_enter_when_done ])

Parameters

  • text
    String. The text to input. Since 2025-06-25, "\b" (backspace) is supported.
  • press_enter_when_done
    Boolean. Whether to press the Enter key (Send/Search etc.) after input. Default: false.

Description

Inputs text into the current foreground app's focused text field.
This function works by first writing the text to the system clipboard, then pasting it with the shortcut (command + v).
This call affects the shared clipboard. Back up important clipboard data before calling.
If the system clipboard is broken (i.e. copy/paste does not work), this function will fail.
Known conflicting tweak: Background Manager.
If it does not work for your case, consider key.send_text.

Examples

sys.input_text("I love you") -- Type "I love you" at the current cursor
--
sys.input_text("I love you", true) -- Type and press Enter (e.g. to send in a chat app)