求Windows屏蔽所有通知一段时间的方法

类似安卓的“勿扰模式”或者windows自带的专注助手,但每次开启能够选择在多久之后解除屏蔽

win10 自带.

时钟 APP

如果卸载了, 点此安装

ms-windows-store://pdp/?ProductId=9wzdncrfj3pr

new bing给的ahk代码:

; 设置快捷键为 Ctrl+Alt+F12
^!F12::
; 弹出一个输入框,让用户输入倒计时时间(以秒为单位)
InputBox, Time, Focus Assist Timer, Enter the time (in seconds) for Focus Assist to be on, , 200, 100
; 如果用户点击了取消或没有输入任何内容,就退出
if ErrorLevel or Time = ""
    return
; 如果用户输入了非数字的内容,就提示错误并退出
if not IsNumber(Time)
{
    MsgBox, Invalid input. Please enter a number.
    return
}
; 将用户输入的时间转换为整数
Time := Floor(Time)
; 开启专注助手(仅闹钟模式)
RegWrite, REG_DWORD, HKEY_CURRENT_USER, SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings, NpsMode, 2
TrayTip, Focus Assist, Focus Assist is now on (Alarms only) for %Time% seconds, 1, 1
; 等待用户输入的时间
Sleep, % Time * 1000
; 关闭专注助手
RegWrite, REG_DWORD, HKEY_CURRENT_USER, SOFTWARE\Microsoft\Windows\CurrentVersion\Notifications\Settings, NpsMode, 0
TrayTip, Focus Assist, Focus Assist is now off, 1, 1
return

; 定义一个函数,判断一个字符串是否为数字
IsNumber(str)
{
    return RegExMatch(str, "^\s*[+-]?\d+(\.\d+)?\s*$")
}

设置,通知相关的选项里就有,不需要时钟app

Win10的似乎没有,11我记得按右下角时钟有?