Last active
April 6, 2023 23:05
-
-
Save bitingsock/a56dddb1e953fdd40e3035b37c387f28 to your computer and use it in GitHub Desktop.
send virtual keystroke (F15) during playback to prevent auto afk of some applications (requires Windows powershell)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local afkTimer = mp.add_periodic_timer(60, function() | |
if mp.get_property("pause") == "no" and mp.get_property("vid") ~= "no" then | |
mp.command_native({ | |
name = "subprocess", | |
capture_stdout = false, | |
playback_only = false, | |
args = { "powershell", "(New-Object -ComObject WScript.Shell).SendKeys('{F15}')" } | |
}) | |
end | |
end) | |
local function reset() | |
afkTimer:kill() | |
afkTimer:resume() | |
end | |
mp.observe_property("pause", nil, reset) | |
mp.register_event("seek", reset) | |
mp.add_key_binding("MOUSE_MOVE", "", reset) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment