-- Types a signature into whatever window has focus after a short countdown,
-- then copies it to the clipboard too.
local hid = require("@neyuki/hid")
local signature = `Best regards,\nYuki\n{os.date("%d %B %Y")}`
for seconds = 3, 1, -1 do
print(`typing in {seconds}... (focus the target window)`)
os.sleep(1)
end
for index, line in signature:split("\n") do
if index > 1 then hid.keyboard.tap("enter") end
hid.keyboard.write(line)
end
hid.clipboard.set(signature)
print("done, and the text is on the clipboard")