-- Map command id → VK_MEDIA_* virtual key code. -- See https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes local cmd_id = jarvis.context.command_id or "" local VK = { ["media.play_pause"] = 179, -- VK_MEDIA_PLAY_PAUSE (0xB3) ["media.next"] = 176, -- VK_MEDIA_NEXT_TRACK (0xB0) ["media.prev"] = 177, -- VK_MEDIA_PREV_TRACK (0xB1) ["media.stop"] = 178, -- VK_MEDIA_STOP (0xB2) } local code = VK[cmd_id] if not code then return jarvis.cmd.error("Неизвестная медиа-команда.") end local helper = jarvis.context.command_path .. "\\_media.ps1" local cmd_str = string.format( 'powershell -NoProfile -ExecutionPolicy Bypass -File "%s" %d', helper, code ) jarvis.system.exec(cmd_str) -- silent — feedback would be annoying for media-key spam return jarvis.cmd.silent_ok()