V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
yjmade
V2EX  ›  Apple

发一个 Mac 语音报时脚本

  •  
  •   yjmade · May 8, 2015 · 3108 views
    This topic created in 4018 days ago, the information mentioned may be changed or developed.

    打开Automator,新建Service脚本,选择 no input,拖入run shell script 模块,输入一下脚本:
    python -c 'import os,datetime,re;os.system("say -v Ting-Ting %s"%re.sub(r"午0(\d)",r"午\1",datetime.datetime.now().strftime("现在时间%p%I点%M分").replace("AM","上午").replace("PM","下午")))'

    保存 命名为 语音报时,打开系统设置->键盘->快捷键->Service,找到语音报时,勾上,设置个快捷键,我的是command+F12.

    然后你就可以在任何地方按这个快捷键,就会响起语音报时了

    3 replies    2015-05-09 13:16:15 +08:00
    yjmade
        1
    yjmade  
    OP
       May 8, 2015
    我比较喜欢在全屏模式下编码,鼠标移上去等菜单栏划出来看时间比较麻烦,所以就自己写了这个
    Daniel65536
        2
    Daniel65536  
       May 9, 2015
    可以用GeekTool弄一个在所有屏幕上悬浮显示的时钟……
    yjmade
        3
    yjmade  
    OP
       May 9, 2015
    @Daniel65536 这样会占用屏幕空间 以及要移动视线..
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   962 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 20:14 · PVG 04:14 · LAX 13:14 · JFK 16:14
    ♥ Do have faith in what you're doing.