05-03-26

Automated Form Filler Lua Script

Automate form filling with a Lua script for hardware input. This script uses the Rebind SDK to type text into fields, tab between them, and customize typing speed and delays.

rebindlua scriptform fillerautomationhardware inputscriptui

Question

Can you provide a Rebind Lua script to fill out a form using stored field values? The script should tab through the fields and allow for configurable delays.

Rebind AI

Here's a Rebind Lua script that fills out a form, tabs between fields, and uses configurable delays:

lua
-- rebind: min_sdk=0.1.0
-- rebind: name=Tab-Through Form Filler

local cfg = UI.Schema({
    trigger = UI.Keybind("F8", { label = "Start Fill", group = "Hotkeys" }),
    field_1 = UI.Text("John Doe", { label = "Field 1", maxLength = 100, group = "Fields" }),
    field_2 = UI.Text("john@example.com", { label = "Field 2", maxLength = 100, group = "Fields" }),
    field_3 = UI.Text("555-1234", { label = "Field 3", maxLength = 100, group = "Fields" }),
    field_4 = UI.Text("123 Main St", { label = "Field 4", maxLength = 100, group = "Fields" }),
    delay = UI.Slider(200, { min = 50, max = 500, suffix = "ms", label = "Inter-Field Delay", group = "Timing" }),
    char_delay = UI.Slider(30, { min = 10, max = 100, suffix = "ms", label = "Type Speed", group = "Timing" }),
})

local fields = {}

function OnStart()
    fields = {
        cfg.field_1,
        cfg.field_2,
        cfg.field_3,
        cfg.field_4,
    }
end

Bind(cfg.trigger, Async(function()
    Log.Info("Starting form fill...")
    
    for i, value in ipairs(fields) do
        if value and #value > 0 then
            HID.Type(value, cfg.char_delay)
            Log.Info("Filled field " .. i)
            
            if i < #fields then
                Sleep(cfg.delay)
                HID.Press("Tab")
                Sleep(100)
            end
        else
            HID.Press("Tab")
            Sleep(100)
        end
    end
    
    Log.Info("Form fill complete")
    UI.Notify("Form filled", "success")
end))

This script allows you to fill out forms automatically. It uses UI.Schema to define configurable fields and timing options. The Bind function associates a hotkey with an Async coroutine that types the field values using HID.Type and presses the Tab key using HID.Press to move between fields. The script also includes logging and visual feedback using Log.Info and UI.Notify.