简体   繁体   English

如何使用 Ruby 在 Windows 上显示简单的通知?

[英]How can I show a simple notification on Windows using Ruby?

How can I show notifications on Windows from a Ruby script?如何从 Ruby 脚本在 Windows 上显示通知?

Currently, I'm using GMail messages but there's a delay...目前,我正在使用 GMail 邮件,但有延迟...
I'm trying to receive an alert and seconds/nanoseconds matter.我正在尝试接收警报,秒/纳秒很重要。

Thank you谢谢

The simplest way to show a notification on Windows with Ruby is to use Win32API and just call MessageBox :使用 Ruby 在 Windows 上显示通知的最简单方法是使用Win32API并调用MessageBox

require 'win32api'

MessageBox = Win32API.new('user32', 'MessageBox', ['L', 'P', 'P', 'L'], 'I')
MessageBox.call(0, "Something important happened", "Alert", 0)

Another more advanced setup is to use something like the Growl notifier , and couple it with the ruby_gntp gem, or Notifu + rb_notifu .另一个更高级的设置是使用Growl 通知程序之类的东西,并将其与ruby_gntp gem 或Notifu + rb_notifu See here for more info on these types of notification systems:有关这些类型的通知系统的更多信息,请参见此处:

https://github.com/guard/guard/wiki/System-notifications https://github.com/guard/guard/wiki/System-notifications

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM