Placeholders
Use dynamic placeholders in your actions for powerful automation.
Available Placeholders
| Placeholder | Description |
|---|---|
{text} | Selected text (via Accessibility API, fast) |
{textWithCopy} | Selected text (via Cmd+C, preserves formatting) |
{clipboard} | Current clipboard content |
{paste} | Simulates Cmd+V paste action |
{prompt} | Shows input dialog for user input |
{date} | Current date (YYYY-MM-DD) |
{time} | Current time (HH:MM:SS) |
{datetime} | Current date and time |
{weekday} | Current day of week (Monday, Tuesday, etc.) |
Text Placeholders
{text} - Selected Text (Fast)
Uses Accessibility API for quick text retrieval.
echo '{text}'
Best for: Simple text operations, most use cases
{textWithCopy} - Selected Text (Accurate)
Uses Cmd+C simulation for accurate text with formatting.
echo '{textWithCopy}'
Best for: When line breaks or formatting matter
{text} vs {textWithCopy}By default, {text} uses the Accessibility API to fetch text—it's fast and doesn't leave a trace in the clipboard. However, it can break line breaks in Chrome/HTML and some other apps.
Key differences:
{text}- No clipboard trace, but formatting may break{textWithCopy}- Leaves clipboard trace, but formatting is preserved
Additionally, {text} behavior depends on whether the app supports the Accessibility API properly. For consistent, formatting-safe results, use {textWithCopy}.
This is a limitation of macOS, not OnText.
Clipboard & Paste
{clipboard} - Clipboard Content
Gets current clipboard without modifying selection.
echo 'Clipboard: {clipboard}, Selected: {text}'
{paste} - Paste Action
Simulates Cmd+V to paste clipboard content.
echo '{text}' | tr 'a-z' 'A-Z' | pbcopy && {paste}
User Input
{prompt} - Interactive Input
Shows a dialog for user input. Perfect for templates!
echo 'TODO: {prompt} - Created on {date}'
Default values: Add text after a colon to set a default value:
echo 'Name: {prompt:User name}'
This will show "User name" as the pre-filled default in the input dialog.
When using multiple {prompt} placeholders, each MUST have a different default value. Otherwise, the action will not execute.
Correct:
echo "Name: {prompt:Enter Name}, Email: {prompt:Enter Email}" | pbcopy
Incorrect (will not work):
echo "Name: {prompt}, Email: {prompt}" | pbcopy
Date & Time
{date} - Current Date
Format: YYYY-MM-DD (e.g., 2024-01-15)
echo '{text} - Added on {date}'
{time} - Current Time
Format: HH:MM:SS (e.g., 14:30:45)
echo '[{time}] {text}'
{datetime} - Date and Time
Combined date and time.
echo 'Log [{datetime}]: {text}'
{weekday} - Day of Week
Full weekday name (Monday, Tuesday, etc.)
echo '{weekday} TODO: {text}'
Examples
Timestamp note:
echo '[{datetime}] {text}' | pbcopy
Template with prompt:
echo 'Meeting: {prompt:Meeting title}\nDate: {date}\nNotes: {text}'
Transform and replace:
echo '{text}' | tr 'a-z' 'A-Z' | pbcopy && {paste}