05-03-26
Email Template Auto-Typer Lua Script
This Lua script for Rebind allows you to select and automatically type email templates into any application using hardware input. Customize typing speed and add your own templates for efficient commun
Question
Can you provide a script for an email template selector and auto-typer?
Rebind AI
[
{
"role": "user",
"content": "Can you provide a script for an email template selector and auto-typer?"},
{
"role": "assistant",
"content": "lua -- rebind: min_sdk=0.1.0 -- rebind: name=Email Template Auto-Typer
local cfg = UI.Schema({ trigger = UI.Keybind("F8", { label = "Paste Template", group = "Hotkeys" }), speed = UI.Slider(30, { min = 10, max = 100, suffix = "ms/char", label = "Typing Speed", group = "Settings" }), })
-- Define email templates local templates = { greeting = "Hi there,\n\nI hope this email finds you well.", followup = "Just following up on my previous email.\n\nLooking forward to your response.", thanks = "Thank you for your time and consideration.\n\nBest regards", closing = "Best regards,\nUser", urgent = "This is marked as urgent.\n\nPlease prioritize accordingly.", }
-- Build template selection menu dynamically local templateNames = {} for name, _ in pairs(templates) do table.insert(templateNames, name) end
local cfg2 = UI.Schema({ selected_template = UI.Select(templateNames[1], templateNames, { label = "Select Template", group = "Templates", }), })
-- Bind the trigger key Bind(cfg.trigger, Async(function() local template = templates[cfg2.selected_template]
if not template then
UI.Notify("Template not found", "error")
return false
end
-- Type the template with configurable speed
HID.Type(template, cfg.speed)
UI.Notify("Template inserted: " .. cfg2.selected_template, "success")
return false
end))
function OnStart() Log.Info("Email Template Auto-Typer loaded") Log.Info("Available templates: " .. table.concat(templateNames, ", ")) end
function OnStop() -- Nothing to clean up end
This script provides an email template system with two UI panels:
1. **Hotkeys Panel**: Configure the trigger key (default F8) and typing speed.
2. **Templates Panel**: Select which email template to insert.
When you press the trigger key, the selected template is typed into the active application character-by-character at your configured speed.
**To add more templates**, simply add entries to the `templates` table:
lua templates.custom = "Your template text here"
The script will automatically make them available in the UI dropdown.
**Tip**: For multi-line text, use `\n` for newlines. Clipboard paste (`Clipboard.Set()` + `HID.Press("LCtrl+V")`) is faster and more reliable for very long templates, but character-by-character typing works everywhere including web-based forms.
Learn more:
- [HID Output](https://docs.rebind.gg/sdk-reference.html#hid)
- [UI Widgets](https://docs.rebind.gg/sdk-reference.html#ui)
- [Bind](https://docs.rebind.gg/sdk-reference.html#bind)
- [Async](https://docs.rebind.gg/sdk-reference.html#async)