32 lines
799 B
Lua
32 lines
799 B
Lua
|
|
local cmd_id = jarvis.context.command_id
|
||
|
|
local helper = jarvis.context.command_path .. "\\_mouse_helper.ps1"
|
||
|
|
|
||
|
|
local actions = {
|
||
|
|
mouse_left_click = "left",
|
||
|
|
mouse_right_click = "right",
|
||
|
|
mouse_middle_click = "middle",
|
||
|
|
mouse_double_click = "double",
|
||
|
|
mouse_scroll_up = "scroll_up",
|
||
|
|
mouse_scroll_down = "scroll_down",
|
||
|
|
}
|
||
|
|
|
||
|
|
local action = actions[cmd_id]
|
||
|
|
if not action then
|
||
|
|
jarvis.audio.play_error()
|
||
|
|
return { chain = false }
|
||
|
|
end
|
||
|
|
|
||
|
|
local res = jarvis.system.exec(string.format(
|
||
|
|
'powershell -NoProfile -ExecutionPolicy Bypass -File "%s" -Action %s',
|
||
|
|
helper, action
|
||
|
|
))
|
||
|
|
|
||
|
|
if res.success then
|
||
|
|
jarvis.audio.play_ok()
|
||
|
|
else
|
||
|
|
jarvis.log("error", "mouse " .. action .. " failed: " .. tostring(res.stderr))
|
||
|
|
jarvis.audio.play_error()
|
||
|
|
end
|
||
|
|
|
||
|
|
return { chain = false }
|