MacOS 快速插入当前时间 (opens in new tab)
第一步:创建快捷指令 打开 Shortcuts。 点击右上角 + 新建快捷指令。 添加动作 1:日期 搜 添加 日期(Current Date) 动作,默认为当前时间 添加动作 2:格式化日期 添加 格式化日期,日期格式 自定义,填 yyyy-MM-dd HH:mm:ss 添加动作 3:Applescript on run {input, parameters} -- 稍微延长一点延迟,确保触发快捷键的手指已经离开键盘 delay 0.1 -- display dialog "Current date" -- 将 Shortcuts 传入的 list 转换为字符串 set ts to item 1 of input as string tell application "System Events" -- 释放可能被系统残留挂起的修饰键状态 -- 键盘区数字的 Key Code 分布是乱序的 set keyCodeMap to {29, 18, 19, 20, 21, 23, 22, 26, 28, 25} key up command key up option key up ...
Read the original article