# ACTIVESTATE TEAPOT-PKG BEGIN TM -*- tcl -*- # -- Tcl Module # @@ Meta Begin # Package tclgrowl 1.1 # Meta as::author {Kevin Walzer} {Toby Peterson} # Meta as::build::date 2013-05-19 # Meta as::origin http://sourceforge.net/projects/tk-components # Meta category Widget # Meta description The tclgrowl package provides a binding for OS X's # Meta description Growl notification service. # Meta license BSD # Meta platform tcl # Meta require {Tcl 8.5} # Meta subject darwin cocoa growl notification # Meta summary OS X Growl Notification binding # @@ Meta End # ACTIVESTATE TEAPOT-PKG BEGIN REQUIREMENTS package require Tcl 8.5 # ACTIVESTATE TEAPOT-PKG END REQUIREMENTS # ACTIVESTATE TEAPOT-PKG BEGIN DECLARE package provide tclgrowl 1.1 # ACTIVESTATE TEAPOT-PKG END DECLARE # ACTIVESTATE TEAPOT-PKG END TM # tclgrowl - Tcl wrapper for Growl on MacOS X # # based on Kevin Walzer's Macgrowl, but modified to work within Starkits # # Tclgrowl Copyright (c) 2009 Steve Landers # Macgrowl Copyright (c) 2008 WordTech Communications LLC # both licensed under the Tcl license # http://www.tcl.tk/software/tcltk/license.html # # Growl available at http://growl.info # package provide tclgrowl 1.1 namespace eval growl { variable send { property theAppName : "$app" property theTitleString : "$title" property theGrowlString : "$msg" tell application id "com.Growl.GrowlHelperApp" set the theNotification to {theAppName & " Notification"} register as application theAppName \ all notifications theNotification \ default notifications theNotification \ icon of application theAppName notify with name \ (item 1 of theNotification) title theTitleString \ description theGrowlString \ application name theAppName end tell } variable check { tell application "System Events" set isRunning to (count of (every process whose bundle identifier \ is "com.Growl.GrowlHelperApp")) > 0 end tell } # check to see if growl is running proc available {} { variable check return [expr {[exec osascript -e $check] eq "true"}] } proc message {app title msg} { variable send exec osascript -e [subst $send] } namespace export * }