V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
bullettrain1433
V2EX  ›  macOS

无聊来调戏下 mac

  •  
  •   bullettrain1433 · 2014-12-14 12:16:10 +08:00 · 5013 次点击
    这是一个创建于 3427 天前的主题,其中的信息可能已经有所发展或是发生改变。

    新建一个mac script,复制以下文本

    set currentUser to long user name of (get system info)
    set firstName to first word of currentUser
    set lastName to last word of currentUser
    set noteValues to {56, 56, 58, 56, 61, 60, 50, 56, 56, 58, 56, 63, 61, 50, 56, 56, 68, 65, 61, 60, 58, 50, 66, 66, 65, 61, 63, 61} -- F
    -- set noteValues to {65, 65, 67, 65, 70, 69, 60, 65, 65, 67, 65, 72, 70, 60, 65, 65, 77, 74, 70, 69, 67, 60, 75, 75, 74, 70, 72, 70} -- D
    -- set noteValues to {55, 55, 57, 55, 60, 59, 50, 55, 55, 57, 55, 62, 60, 50, 55, 55, 67, 64, 60, 59, 57, 50, 65, 65, 64, 60, 62, 60} -- E
    set syllables to {"hap", "p", "birth", "day", "to", "you", "[[slnc 500]]", "hap", "p", "birth", "day", "to", "you", "[[slnc 500]]", "hap", "p", "birth", "day", "dear", firstName, lastName, "[[slnc 500]]", "hap", "p", "birth", "day", "to", "you"}
    repeat with i from 1 to the length of noteValues
        set thisValue to item i of noteValues
        set thisSyllable to item i of syllables
        if length of thisSyllable is less than 3 then
            set speakingRate to 220
        else
            set speakingRate to 100
        end if
        say thisSyllable pitch thisValue using "Victoria" speaking rate speakingRate modulation 0
    end repeat
    

    运行下,哈哈,为你唱生日祝福

    37 条回复    2014-12-16 01:09:22 +08:00
    belin520
        1
    belin520  
       2014-12-14 12:47:04 +08:00
    楼下测试了有副作用吗?
    xuc
        2
    xuc  
       2014-12-14 12:49:39 +08:00
    真的醉了
    Kabie
        3
    Kabie  
       2014-12-14 12:50:40 +08:00
    ....这能有啥副作用。。。
    ivanlw
        4
    ivanlw  
       2014-12-14 12:50:58 +08:00 via iPhone
    请问什么叫Mac script
    imn1
        5
    imn1  
       2014-12-14 12:51:54 +08:00
    寻衅滋事
    sammo
        6
    sammo  
       2014-12-14 13:17:01 +08:00
    @ivanlw 打开 /Applications/Utilities/AppleScript Editor.app (或者直接 Spotlight 搜 AppleScript 编辑器 ) ,把上面的 ``` ``` 之间的东西复制进去,点运行
    ivanlw
        7
    ivanlw  
       2014-12-14 13:52:29 +08:00
    @sammo 谢谢……给自己的生日礼物~
    shangyingao
        8
    shangyingao  
       2014-12-14 14:49:15 +08:00
    听着也是醉了:-)
    neoman
        9
    neoman  
       2014-12-14 14:52:57 +08:00
    醉了
    qiuai
        10
    qiuai  
       2014-12-14 14:56:46 +08:00
    一会试试
    hahastudio
        11
    hahastudio  
       2014-12-14 15:06:06 +08:00
    hap, pi--
    xdeng
        12
    xdeng  
       2014-12-14 15:19:51 +08:00
    我好像看懂了
    hasse
        13
    hasse  
       2014-12-14 15:44:53 +08:00
    醉了~ 谢谢~
    twoyuan
        14
    twoyuan  
       2014-12-14 15:47:46 +08:00
    哈哈 有意思
    en3073
        15
    en3073  
       2014-12-14 15:52:55 +08:00
    醉了,23333333,谢谢,我也是觉得真有意思
    mcfog
        16
    mcfog  
       2014-12-14 16:03:14 +08:00
    "p"改成“b”效果更好
    jaylong
        17
    jaylong  
       2014-12-14 16:06:32 +08:00
    楼主的高亮代码是怎么发布的?
    Livid
        18
    Livid  
    MOD
       2014-12-14 16:07:08 +08:00
    iOct
        19
    iOct  
       2014-12-14 16:19:56 +08:00
    醉了,呵呵……
    rayps
        20
    rayps  
       2014-12-14 17:31:28 +08:00
    把代码中的 Victoria 换成 Alex 就变成男声了
    shao
        21
    shao  
       2014-12-14 17:39:55 +08:00
    调戏得不错
    shiny
        22
    shiny  
       2014-12-14 17:49:03 +08:00
    一回想,只觉得像是鬼片里面那种风格……
    littlewey
        23
    littlewey  
       2014-12-14 19:44:20 +08:00
    thanks!!
    bullettrain1433
        24
    bullettrain1433  
    OP
       2014-12-14 19:48:14 +08:00
    @jaylong ```` ```` markdown语法
    17chai
        25
    17chai  
       2014-12-14 19:53:46 +08:00
    周二生日,用上
    bullettrain1433
        26
    bullettrain1433  
    OP
       2014-12-14 19:54:52 +08:00
    @17chai 哈哈,正好
    gaia
        27
    gaia  
       2014-12-14 21:35:19 +08:00
    有才:)
    varrily
        28
    varrily  
       2014-12-14 21:54:38 +08:00
    哈哈,有意思~~
    TankyWoo
        29
    TankyWoo  
       2014-12-14 21:56:46 +08:00
    有意思,感谢
    konakona
        30
    konakona  
       2014-12-15 05:00:55 +08:00
    @sammo 搜不到..
    XDA
        31
    XDA  
       2014-12-15 08:02:00 +08:00 via Android
    注孤生!
    等会到公司放给我一个最近要过生日的同事听,哈哈
    rocai185
        32
    rocai185  
       2014-12-15 08:05:56 +08:00
    给朋友听了,回复“写来这么多就那么两句简单的话!”
    jxdwinter
        33
    jxdwinter  
       2014-12-15 08:41:05 +08:00
    哈哈哈,看懂了,有意思.
    ioth
        34
    ioth  
       2014-12-15 09:18:32 +08:00
    mark
    scorpius
        35
    scorpius  
       2014-12-15 10:34:07 +08:00
    有意思。
    clippit
        36
    clippit  
       2014-12-15 14:04:27 +08:00
    为什么我突然想到 Portal 里 GLaDOS
    rudolf
        37
    rudolf  
       2014-12-16 01:09:22 +08:00
    已醉。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2264 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 77ms · UTC 03:01 · PVG 11:01 · LAX 20:01 · JFK 23:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.