aboutsummaryrefslogtreecommitdiffstats
path: root/ufo.lua
diff options
context:
space:
mode:
Diffstat (limited to 'ufo.lua')
-rw-r--r--ufo.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/ufo.lua b/ufo.lua
index c374a65..3713514 100644
--- a/ufo.lua
+++ b/ufo.lua
@@ -18,3 +18,18 @@ ufo_mode:bind({}, 'r', function()
ufo_mode:exit()
end)
+
+-- Edit, close, and save an MS Word document
+ufo_mode:bind({}, 'w', function()
+ math.randomseed(os.time())
+ local number = math.random(0, 9)
+
+ hs.eventtap.keyStroke({}, 'forwarddelete')
+ hs.eventtap.keyStroke({}, tostring(number))
+ hs.eventtap.keyStroke({'command'}, 'w')
+ hs.timer.doAfter(0.05, function()
+ hs.eventtap.keyStroke({}, 'return')
+ end)
+
+ ufo_mode:exit()
+end)