View unanswered posts | View active topics It is currently October 30th, 2014, 4:36 pm



Reply to topic  [ 8 posts ] 
 Using Growl for Windows with Rainmeter 
Author Message
Online

Developer

User avatar

Joined: April 19th, 2009, 11:02 pm
Posts: 11057
Location: Fairfax, VA
Post Using Growl for Windows with Rainmeter
November 29th, 2009, 5:10 am
It is possible to call "Growl for Windows" from Rainmeter, so it will pop up a nice "toaster" above your system tray on an action. Growl is pretty configurable, and can use different skins and sounds, be "sticky" or just stay up for xx seconds, lots of other parameters you can set in the application itself.

So to use it:

1) Download Growl for Windows from here: http://www.growlforwindows.com/gfw/
2) Install it and run it. IT MUST BE RUNNING IN THE BACKGROUND TO USE IT, SO YOU MIGHT WANT TO START IT WITH WINDOWS
3) Set up your Rainmeter skin with code like this:

;=================================================
; Rainmeter configuration file
; Updated October 9, 2009
;=================================================

;[BEGIN CONFIG FILE]==============================

[Rainmeter]
Author=Jeffrey Morley
Update=1000

[StringStyle]
FontColor=255,255,255,255
FontFace=Trebuchet MS
FontSize=12
StringEffect=NONE
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1

;[GMAIL]===========================================

[MeasureMailCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=https://jsmorley:password@gmail.google.com/gmail/feed/atom
RegExp="(?siU)<fullcount>(.*)</fullcount>"
StringIndex=2
FinishAction=!Execute [!RainmeterRedraw]
UpdateRate=60

[MeasureNewCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureMailCount]
StringIndex=1

[MeterNewLabel]
Meter=STRING
MeterStyle=StringStyle
X=1
Y=1
Text="GMail"
LeftMouseDownAction=!Execute ["https://mail.google.com/mail/#inbox"]

[MeterNewCount]
Meter=STRING
MeasureName=MeasureNewCount
MeterStyle=StringStyle
X=1
Y=21
Text="%1 New"
LeftMouseDownAction=!Execute ["https://mail.google.com/mail/#inbox"]

[GrowlAction]
Measure=Calc
Formula=MeasureNewCount
IfAboveAction=!execute ["C:\Program Files\Growl for Windows\growlnotify.exe" "/r:Rainmeter" "/a:Rainmeter" "/n:Rainmeter" "/t:GMail" "/i:#CURRENTPATH#Envelope.png" "You have [MeasureNewCount] new message(s)"]
IfAboveValue=0


4) Put this image in the folder with your skin:



5) Load your skin, and send yourself an email or mark an existing one as "unread" in your inbox.
6) Growl will get the notification from Rainmeter, and will then "register" as a supported application.
7) Now from the Growl system tray icon, click "Open Growl" and from the "Applications" tab, set any parameters you want for "Rainmeter"
8) Close the Growl window (but leave it running in the system tray)

Now when you get a new mail (when the "count" changes from zero to non-zero) you will get a very spiffy Growl notification above your system tray.



Note: Due to the way a calc statement works with IfAboveAction, you will NOT get a notification when the count changes from for instance "1" to "2", as both are "above" 0 and the action will not fire. You can of course do separate IfAboveAction statements for 0,1,2,3,4 etc. if you want. There may be a more glamorous way around this limitation, but I haven't tumbled on it yet.

P.S. Here is the documentation for using Growl for Windows in "Command Line" mode:
NAME

     growlnotify -- Send a Growl notification to a local or remote host

SYNOPSIS

     growlnotify [/t:title] [/id:id] [/s:sticky] [/p:priority] [/i:icon]
            [/a:application] [/r:types] [/n:type]
            [/cu:callbackurl]
            [/host:host] [/port:port]
            [/pass:password] [/enc:algorithm] [/hash:algorithm]
            [/silent:suppressoutput]
            messagetext

DESCRIPTION

     Only messagetext is required. All other switches will use default values.

     /t:title             The notification title.
                          Use \n to specify a line break. Use \\n for a literal '\n'.
                          Default: "growlnotify"

     /id:id               The notification id.
                          Default: ""

     /s:sticky            Indicates if the notification should be sticky.
                          Valid values: true|false
                          Default: false

     /p:priority          The notification priority.
                          Valid values: -2|-1|0|1|2
                          Default: 0

     /i:icon              The icon to show for the notification.
                          Must be a valid file type (png, jpg, gif, ico).
                          Can be any of the following:
                              - absolute url (http://domain/image.png)
                              - absolute file path (c:\temp\image.png)
                              - relative file path (.\folder\image.png) (relative file paths
                                must start with a dot (.) and are relative to growlnotify's
                                location
                          Note: Icons specified as urls will be passed as urls (links). Icons
                                specified as local files (either absolute or relative) will be
                                sent as binary data.
                          Default: no icon

     /a:application       The name of the application sending the notification.
                          The application must already be registered unless the
                          /r switch is included. The default 'growlnotify'
                          application does not need to be explicitly registered.
                          Default: growlnotify

     /r:types             Register the application first.
                          'types' is a comma-separated list of the notification types to register.
                          Default: application not automatically registered
                          Examples:
                              /r:"Some Notification"
                              /r:"Notification One","Notification Two","Notification Three"

     /n:type              The notification name/type.
                          Default: "General Notification"

     /cu:callbackurl      A callback url (will be opened if the notification is clicked).
                          Default: no callback

     /host:host           The host address to send the notification to.
                          If any value other than 'localhost' or '127.0.0.1' is provided, the
                          host is considered a remote host and the /pass switch must also be provided.
                          Default: localhost

     /port:port           The port to send the notification to.
                          Default: 23053

     /pass:password       The password required to send notifications.
                          A password is required to send a request to a remote host. If /host
                          is specified and is any value other than 'localhost' or '127.0.0.1',
                          then /pass is also required.
                          Default: no password

     /enc:algorithm       The encryption algorithm to use.
                          Valid values: NONE|DES|3DES|AES
                          If a value other than NONE is provided, the
                          /pass and /hash switches must also be included.
                          Default: NONE

     /hash:algorithm      The hashing algorithm to use.
                          Valid values: MD5|SHA1|SHA256|SHA512
                          This value is only used if the /pass switch is also
                          set.
                          Default: MD5

     /silent:nooutput     When run from the command line, indicates if response output
                          should be suppressed or not.
                          Valid values: true|false
                          Default: false

     messagetext          The notification's text - Required
                          Use \n to specify a line break. Use \\n for a literal '\n'.

EXAMPLES

     Example using all switches:

     growlnotify /t:"my notification" /id:12345 /s:true /p:2 /i:"c:\apple.png" /a:"growlnotify example" /r:"Example Notification","Another Type of Notification" /n:"Example Notification" /cu:"http://www.google.com" /host:localhost /port:23053 /pass:"secret" /enc:DES /hash:SHA256 /silent:true "this is the notification text\n\nit includes some line breaks"

NOTES

     There are two ways to use growlnotify.
     
     1. growlnotify.com - Can be used from the console or included in batch scripts. Writes
                          success/failure messages to the console when the notification is
                          sent. Equivalent to using just 'growlnotify' with no extension.

     2. growlnotify.exe - Can be used with tools like AutoHotkey or launched from other GUI
                          applications. Will not spawn a console window, so notifications can
                          be sent silently. No success or failure report is available. Must
                          explicitly include the .exe extension in order for Windows to
                          recognize which version to use.

Profile

Rainmeter Sage

User avatar

Joined: July 19th, 2009, 5:59 am
Posts: 661
Location: Montreal, QC, Canada
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 6:45 am
This is actually a neat little program. You could in theory use a Rainmeter skin in a similar fashion, but it would be way more complicated. The fact that you can use the command line to create a popup is really handy. I tweaked that skin a little bit so it's now an actual notifier. On the first run, it tells you how many messages you have, then afterward, if that number increases (ie: you get and e-mail), it will show a popup through growl telling you so, as well as the title and sender of the message. Here's the modified code:
;=================================================
; Rainmeter configuration file
; Updated October 9, 2009
;=================================================

;[BEGIN CONFIG FILE]==============================

[Rainmeter]
Author=Jeffrey Morley/Alex Attar/Viewers Like You
Update=1000

[Variables]
MailCount=0
FirstRun=0

[StringStyle]
FontColor=255,255,255,255
FontFace=Trebuchet MS
FontSize=12
StringEffect=NONE
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1

;[GMAIL]===========================================
[MeasureMailCount]
Measure=Plugin
Plugin=Plugins\WebParser.dll
URL=https://username:password@gmail.google.com/gmail/feed/atom
RegExp="(?siU)<fullcount>(.*)</fullcount>.*(?=<title>(.*)</title>.*<name>(.*)</name>)"
StringIndex=1
DynamicVariables=1
FinishAction=!Execute [!RainmeterRedraw]
UpdateRate=60
Substitute="":"0"

[MailCount]
Measure=Calc
DynamicVariables=1
Formula=#MailCount#

[MeasureNewMailTitle]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureMailCount]
StringIndex=2

[MeasureNewMailSender]
Measure=Plugin
Plugin=Plugins\WebParser.dll
Url=[MeasureMailCount]
StringIndex=3

[MeterNewLabel]
Meter=STRING
MeterStyle=StringStyle
X=1
Y=1
Text="GMail"
LeftMouseDownAction=!Execute ["https://mail.google.com/mail/#inbox"]

[MeterNewCount]
Meter=STRING
MeasureName=MeasureMailCount
MeterStyle=StringStyle
X=1
Y=21
Text="%1 New"
LeftMouseDownAction=!Execute ["https://mail.google.com/mail/#inbox"]

[CheckFirst]
Measure=Calc
Formula=First
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!Execute [!RainmeterDisableMeasure FirstGrowlAction][!RainmeterEnableMeasure NewGrowlAction]

[First]
Measure=Calc
Formula=#FirstRun#
DynamicVariables=1

[NotFirst]
Measure=Calc
Formula=(#FirstRun#=0)
DynamicVariables=1

[FirstGrowlAction]
Measure=Calc
Formula=MeasureMailCount
IfAboveAction=!execute ["C:\Program Files\Growl for Windows\growlnotify.exe" "/r:Rainmeter" "/a:Rainmeter" "/n:Rainmeter" "/t:GMail" "/i:#CURRENTPATH#Envelope.png" "You have [MeasureMailCount] new message(s)"][!RainmeterSetVariable MailCount [MeasureMailCount]][!RainmeterSetVariable FirstRun 1]
IfAboveValue=#MailCount#
IfEqualValue=0
IfEqualAction=!execute ["C:\Program Files\Growl for Windows\growlnotify.exe" "/r:Rainmeter" "/a:Rainmeter" "/n:Rainmeter" "/t:GMail" "/i:#CURRENTPATH#Envelope.png" "You have no new messages"][!RainmeterSetVariable MailCount [MeasureMailCount]][!RainmeterSetVariable FirstRun 1]
DynamicVariables=1
Disabled=[CheckFirst]

[NewGrowlAction]
Measure=Calc
Formula=MeasureMailCount
IfAboveAction=!execute ["C:\Program Files\Growl for Windows\growlnotify.exe" "/r:Rainmeter" "/a:Rainmeter" "/n:Rainmeter" "/t:GMail" "/i:#CURRENTPATH#Envelope.png" "Message Recieved: [MeasureNewMailTitle] from [MeasureNewMailSender]"][!RainmeterSetVariable MailCount [MeasureMailCount]]
IfAboveValue=#MailCount#
IfBelowValue=#MailCount#
IfBelowAction=!RainmeterSetVariable MailCount [MeasureMailCount]
DynamicVariables=1
Disabled=[NotFirst]

There are a couple of extra measures, notable [First] and [NotFirst] in order to compensate for the bug with Dynamic Variables that doesn't allow a measure or meter using them to be disabled/hidden through a bang. Works great though!

[EDIT] Noticed that if you start it up with no new messages, it would do the first run when a message came in, rather than the notification. Fixed now ;)

Profile
Online

Developer

User avatar

Joined: April 19th, 2009, 11:02 pm
Posts: 11057
Location: Fairfax, VA
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 6:49 am
Very cool! Great improvement!

Profile
Online

Developer

User avatar

Joined: April 19th, 2009, 11:02 pm
Posts: 11057
Location: Fairfax, VA
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 1:18 pm
It's just about perfect. I did find that it displays a bit nicer with a few linefeeds:

IfAboveAction=!execute ["C:\Program Files\Growl for Windows\growlnotify.exe" "/r:Rainmeter" "/a:Rainmeter" "/n:Rainmeter" "/t:GMail" "/i:#CURRENTPATH#Envelope.png" "Message Recieved \n[MeasureNewMailTitle]\nFrom\n[MeasureNewMailSender]"][!RainmeterSetVariable MailCount [MeasureMailCount]]

Profile
User avatar

Joined: August 7th, 2009, 11:23 pm
Posts: 91
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 7:21 pm
Well, I know what /n stands for, but what do the other /xyz things mean?

Profile WWW
Online

Developer

User avatar

Joined: April 19th, 2009, 11:02 pm
Posts: 11057
Location: Fairfax, VA
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 7:30 pm
Samus Aran wrote:
Well, I know what /n stands for, but what do the other /xyz things mean?


Read my first post. There is a codebox with "documentation for command line tool" there. It's about 4 scroll-wheel revolutions up... You don't even have to cross the street.

Profile
User avatar

Joined: August 7th, 2009, 11:23 pm
Posts: 91
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 7:51 pm
Sorry, my fault. :(
Didn't read that box :p

Profile WWW
Online

Developer

User avatar

Joined: April 19th, 2009, 11:02 pm
Posts: 11057
Location: Fairfax, VA
Post Re: Using Growl for Windows with Rainmeter
November 29th, 2009, 9:11 pm
Samus Aran wrote:
Sorry, my fault. :(
Didn't read that box :p


;-)

Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.