05-17-26

Mouse Drag Assist Script

Convert an AutoHotkey script to a Rebind Lua script for hardware input. This script provides a mouse drag assist feature, allowing continuous downward movement when holding the left mouse button, with

rebindlua scriptmousedragassisthardware inputscript

Question

can you rewrite this into a rebind script

Rebind AI

I'd be happy to help rewrite something into a Rebind script! However, I don't see any code in your message. Could you paste the script or code you'd like me to convert?

Once you share it, please also let me know:

  • What does it do? (e.g., auto-clicker, macro player, key remap, etc.)
  • What game or application is it for? (if any)
  • Are there any specific behaviors you want to preserve?

Then I'll convert it to Luau and make it work with the Rebind SDK.

Question

Gui, Add, Text, xm ym+3, Hotkey: Gui, Add, Hotkey, xm+40 ym vHotkeyC w240, % HotkeyCC := "End" Hotkey, End, CheckBox Gui, Add, Text, xm ym+33, Speed: Gui, Add, Edit, xm+40 ym+30 vSpeed w240 ,1 Gui, Add, CheckBox, xm+200 ym+67 vED gCheckBox, Toggle Script Gui, Add, Button, xm ym+60 w100, Apply Changes Gui, Show, w300

Hotkey, LButton, LeftButton, Off Hotkey, LButton Up, LeftButtonUp, Off Return

GuiClose: ExitApp

LeftButton: Gui, Submit, NoHide SendInput, {LButton Down} SetTimer, DragDown, % 10 / Speed Return

LeftButtonUp: SendInput, {LButton Up} SetTimer, DragDown, Off Return

DragDown: Gui, Submit, NoHide DllCall("mouse_event", "UInt", 0x01, "UInt", 0, "UInt", 1 + Speed) Return

CheckBox: Gui, Submit, NoHide If (A_ThisHotkey = HotkeyCC) GuiControl,, ED, % !ED Gui, Submit, NoHide Stat := (ED) ? "On" : "Off" Hotkey, LButton, % Stat Hotkey, LButton Up, % Stat Return

ButtonApplyChanges: Gui, Submit, NoHide If (HotkeyC != HotkeyCC) { Hotkey, % HotkeyCC, CheckBox, Off Hotkey, % HotkeyCC := HotkeyC, CheckBox, On } Return

Rebind AI

This is an AutoHotkey script for a mouse drag/aim assist tool. Here's the Rebind version:

lua
-- rebind: min_sdk=0.1.0
-- rebind: name=Drag Assist
-- rebind: description=Hold mouse button to continuously move down

local cfg = UI.Schema({
    enabled = UI.Toggle(true, { label = "Enable Script" }),
    hotkey = UI.Keybind("End", { label = "Toggle Hotkey" }),
    speed = UI.Slider(1, { min = 0.1, max = 10, step = 0.1, label = "Speed" }),
})

local dragging = false
local dragTask = nil

function OnDown(key)
    if key == cfg.hotkey then
        cfg.enabled = not cfg.enabled
        UI.Notify(cfg.enabled and "Enabled" or "Disabled", "info")
        return false
    end

    if key == "Mouse1" and cfg.enabled then
        dragging = true
        HID.Down("Mouse1")
        dragTask = Run(function()
            while dragging and Input.IsDown("Mouse1") do
                HID.Move(0, 1 + cfg.speed)
                Sleep(10)
            end
        end)
        return false
    end

    return true
end

function OnUp(key)
    if key == "Mouse1" then
        dragging = false
        if dragTask and dragTask:IsRunning() then
            dragTask:Cancel()
            dragTask = nil
        end
        HID.Up("Mouse1")
        return false
    end
    return true
end

function OnBlur()
    dragging = false
    if dragTask and dragTask:IsRunning() then
        dragTask:Cancel()
        dragTask = nil
    end
    HID.Up("Mouse1")
end

What changed:

  • GUI → UI Schema: The AutoHotkey GUI controls are now a UI.Schema with three settings (enable toggle, hotkey selector, speed slider)
  • Hotkey handling: The End key (configurable) toggles the script on/off
  • Mouse drag logic: When Mouse1 (left button) is held, it sends continuous downward movement at 10ms intervals, scaled by the speed multiplier
  • Cleanup: OnBlur safely cancels the drag task and releases the mouse button if the window loses focus
  • Persistent UI: Settings are automatically saved and restored on reload

How to use:

  1. Create a new script in Rebind and paste this code
  2. Press End to toggle the script on/off
  3. Adjust Speed in the settings panel (higher = more downward movement per tick)
  4. Hold the left mouse button to activate the drag assist

Learn more:

Question

how do i open the gui

Rebind AI

The Rebind GUI opens automatically when you load a script. Here's how:

  1. Launch Rebind — open http://localhost:19480 in your browser
  2. Go to the Modules tab — this is where scripts live
  3. Create a new script — click the + button or "New Script"
  4. Paste the script code — copy the Lua script into the editor
  5. The UI appears automatically — once the script loads, you'll see a settings panel on the right side of the Rebind UI with your configured widgets (the toggle, hotkey picker, and speed slider)

You don't need to do anything special — the UI renders directly in the Rebind web interface, not as a separate window like the AutoHotkey GUI did.

The settings panel shows:

  • Enable Script toggle
  • Toggle Hotkey (defaults to End, click to rebind)
  • Speed slider

All changes are saved automatically. When you toggle the script on/off or adjust the speed, those values persist across reloads.

If you want to hide/collapse the UI panel, there's a minimize icon in the top-right corner of the settings area.