If I knew enough Obj-C, I would do it myself, but alas, this old fart
brain just melts down when I dig really really deep into it.
How about a Notification that simply runs the same as a command-line
script / process? I've dug around the MailMe Notification and found
the python script (simple-mailer.py) that runs. I don't see any reason
why someone couldn't write a simple Notification without any screen
feedback (or maybe along with one) that would pass the various parts
of a Notification (Title, Description, Priority, etc...) as
parameters, to be picked up with $1, $2, etc...
>From there we could make up our own mind what we want to do... If we
to run an AppleScript to open a file when a download is done, for
instance, then when this notification goes off it's a matter of using
(saying $1=Application, $2=Title, $3=Description, $4=priority):
--------------------
#!/bin/sh
osascript <<EOF
set tApplication to "$1"
set tTitle to "$2"
set tDescription to "$3"
set tPriority to "$4"
if tApplication = "Some Downlader App" then
if tTitle = "Download Complete" then
tell application "Finder"
reveal tDescription
end tell
end if
end if
EOF
exit
--------------------
Or, in my case, I would be sending raw Apple Events to SuperCard:
--------------------
#!/bin/sh
osascript <<EOF
ignoring application responses
tell application "SuperCard 4.6"
«event GrwlNoti» "Growl Notification" given «class appl»:"$1",
«class titl»:"$2", «class desc»:"$3", «class prio»:"$4"
end tell
end ignoring
EOF
exit
--------------------
Then it's a matter of picking up in my "on appleEvent" handler:
request appleEvent data with keyword "appl"
put it into tApplication
request appleEvent data with keyword "titl"
put it into tTitle
etc...
I'm sure osaScript could be run directly (#!/usr/bin/osascript), or
like the Hello World example in "man osascript". Perl would probably
be happy with it, for those who like, and, of course, python, as well
as a few others.
This should be little to no different than what MailMe is doing with
the python script "simple-mailer.py":
--------------------
#!/usr/bin/env python
# Usage: simple-mailer [--[no-]tls] username[:passwo...@server[:port]
from to subject
--------------------
... although a bang line like that (calling env then the interpreter)
is new to me. If that becomes some kind of requirement, well... I'm up
to learning something new about scripts.
As for the GUI in the PrefPane? One thought would be to have a list...
Select an app that a notification would come from and enter (choose)
the path to the script to run. Or maybe a plist file that can be
maintained with "defaults write..." (or the AppleScript equivalent).
If the script were called in the Obj-C code that is the equivalent of
shell's "command-name &> /dev/null" then it can release right away and
not tie up any Notification code. Or maybe (with me not knowing the
intricacies of Obj-C Growl Notifications) some clever coder could even
work out how a reply (or stdout) could emulate a Notification
callback. That's just a maybe, of course. I don't have all the
answers. :-)
It just seems like all of this could be done in an Obj-C Notification
without having to modify the core Growl code at all.
Any takers?
Dave.
On Mar 12, 10:23 pm, Peter Hosey <[email protected]> wrote:
> On Mar 12, 2010, at 20:20:59, skweek wrote:
>
> > Has anyone found or figured or know a way to make a Growl
> > Notification an applescript or script.
>
> This would require Growl to support it, which it currently doesn't.
--
You received this message because you are subscribed to the Google Groups
"Growl Discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/growldiscuss?hl=en.