JS里操作苹果应用API

2020年04月09日 11:37

https://github.com/BaksiLi/AlfredWorkflows/blob/master/Index/DarkOrLight/DarkOrLight.sh 里面的

Script="tell app \"System Events\" to tell appearance preferences to set dark mode to $dark"

osascript -e "$Script"

应该在 JS 里面调用 exec 就好了,以后写 Electron 应用可能会用到。

Code
看 https://github.com/BaksiLi/AlfredWorkflows/blob/master/Index/DarkOrLight/DarkOrLight.sh
里面的 

```sh
Script="tell app \"System Events\" to tell appearance preferences to set dark mode to $dark"

osascript -e "$Script"
```

应该在 JS 里面调用 `exec` 就好了,以后写 Electron 应用可能会用到。