Created
August 4, 2022 11:58
-
-
Save hooke007/c0ddde8a4acc0a6ead78439c883a7bd6 to your computer and use it in GitHub Desktop.
[mpv-script] 快捷键循环命令
This file contains hidden or 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
// 使用单个快捷键依次执行指令 | |
// input.conf | |
// KEY script-message cycle-cmd "CMD1" "CMD2" | |
// Created by https://github.com/avih | |
var registry = {}; | |
mp.register_script_message("cycle-cmd", function() { | |
var key = JSON.stringify(arguments); | |
if (!(registry[key] >= 0)) | |
registry[key] = -1; | |
registry[key] = (registry[key] + 1) % arguments.length; | |
mp.command(arguments[registry[key]]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment