1篇 applescript related articles

在mac命令行执行显示通知

需要用的工具:
osascript在macos上可以执行AppleScript, JavaScript等.
这里介绍AppleScript两个常用命令: display, say.

display

这个命令可以在mac上发送系统通知,macos 会在侧边栏显示这个通知消息。
AppleStript这样写 display notification "hello world!"

为了执行这条命令需要用到osascript, 并且需要-e参数,后面跟的单引号字符引用的命令
执行发送这条通知:
osascript -e 'display notification "hello world!"'

Screen Shot 2019-07-17 at 12.31.58.png

这条通知显示在屏幕右上角,3秒后消失。

More ~