reka-flash-20240722· unknown
LMArena Human Preference 100K
Write a Hammerspoon script that repeats this sequence of actions 3 times: click at…
- User
Write a Hammerspoon script that repeats this sequence of actions 3 times: click at (1150,100), wait for 1 second, click at (850,750), wait for 2 seconds. Add hotkeys "ctrl+alt+cmd+M" to start the sequence and "ctrl+alt+cmd+N" to terminate.
- Assistant
Here's a Hammerspoon script that performs the specified sequence of actions three times and binds hotkeys "ctrl+alt+cmd+M" to start the sequence and "ctrl+alt+cmd+N" to terminate it:
lua-- Constants for the click positions and wait times local clickPosition1 = {x = 1150, y = 100} local clickPosition2 = {x = 850, y = 750} local waitTime1 = 1 local waitTime2 = 2 -- Function to perform the sequence of actions local function performSequence() for _ = 1, 3 do hs.mouse.click(clickPosition1.x, clickPosition1.y) hs.timer.sleep(waitTime1 * 1000) hs.mouse.click(clickPosition2.x, clickPosition2.y) hs.timer.sleep(waitTime2 * 1000) end end -- Hotkey to start the sequence hs.hotkey.bind({"ctrl", "alt", "cmd"}, "M", performSequence) -- Hotkey to terminate the sequence (optional) hs.hotkey.bind({"ctrl", "alt", "cmd"}, "N", function() hs.alert.show("Sequence terminated.") end)