欢迎加入 TidyFriday !
现在加入即可享受 8 折优惠! See: https://czxa.top/posts/34814/
The last article introduced how to create desktop notifications from R. In this article, I’ll show you how to create destop notifications from Stata or any other Apps!
Fist we need to know how does notifier work, As for Mac OS, it just loads terminal-notifier. So, let’s first explore the use of this command.
。
1 | $ brew install terminal-notifier |
1 | $ terminal-notifier -help |
This parameter is the Bundle ID of APP. So how to find it?
For example, we open RStudio.app
, find a file named Info.plist
:
You can find these two lines in Info.plist
:1
2<key>CFBundleIdentifier</key>
<string>org.rstudio.RStudio</string>
org.rstudio.RStudio
is RStudio’s Bundle ID. Another example is Stata15 SE:
1 | <key>CFBundleIdentifier</key> |
We can find it in the system preference setting 👉 sound effects:
These are the parameters that can be used. Default parameter is default
(I think the default
notice voice is the clearest).
For example:
1 | $ terminal-notifier -message "Stata 通知" -title "来自Stata的通知" -sound default -sender "com.stata.stata15" |
1 | $ terminal-notifier -message "Reeder通知" -title "来自Reeder的通知" -sound default -sender "com.reederapp.rkit2.mac" |
First let’s see where the terminal-notifier
command is installed:
1 | $ which terminal-notifier |
Then we can write a Stata command named notifier:
1 | *! notifier: Create Desktop Notifications from Stata |
notifier
in Stata programs1 | forval i = 1/100{ |
Update your browser to view this website correctly. Update my browser now