Skip to content

Instantly share code, notes, and snippets.

@bitingsock
bitingsock / noAFK.lua
Last active April 6, 2023 23:05
send virtual keystroke (F15) during playback to prevent auto afk of some applications (requires Windows powershell)
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)