Commercial macro tools felt unsafe. This is a DIY USB macro keyboard/mouse:

  • ATmega32U4 (Leonardo) emulates HID keyboard/mouse
  • Qt + Lua on the host parses automation scripts

Downloads

Lua demo

local keymap = {
  KEY_LEFT_CTRL = '0x80',
  KEY_TAB = '0xB3',
  KEY_RETURN = '0xB0',
  -- ... full table in macro-demo.lua
}

function this:get_keymap(k)
  return tonumber(keymap[k])
end

function this:move(x, y, z)
  -- splits moves into 100px steps for the HID protocol
end

function this:alt_tab()
  self:call('kpress ' .. self:get_keymap('KEY_LEFT_ALT'))
  self:call('kwrite ' .. self:get_keymap('KEY_TAB'))
  self:call('krelease ' .. self:get_keymap('KEY_LEFT_ALT'))
end

The macro-demo.lua file includes a sample main() automation loop.