Growl Applescript and no Growl installed

The Growl forums have moved to Google Groups, this forum is read only.
soj
Muffin
Posts: 41
Joined: Tue Aug 29, 2006 5:12 am

Post by soj »

I've looked at http://growl.info/documentation/ and http://trac.growl.info/trac/ticket/324 ... not finding what you're describing.
User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Post by The_Tick »

Click on developer docs...
soj
Muffin
Posts: 41
Joined: Tue Aug 29, 2006 5:12 am

Post by soj »

Do I need to add this code anywhere and if so where?
User avatar
The_Tick
Cocoaforge Admin
Posts: 4642
Joined: Thu Dec 02, 2004 6:06 am
Contact:

Post by The_Tick »

I don't get your question. Please be verbose.
DeltaTee
Latté
Posts: 71
Joined: Sun Jun 05, 2005 7:58 pm
Contact:

Post by DeltaTee »

A while back I wrote a generic notification wrapper that will use growl if it is available, or a dialog if it is not. The code is not really pretty (and incredibly long). If anyone is interested in using the code, let me know. The important thing to note is that you can't use the name of the application in a tell block if the application does not exist on the system. The code ends up looking something like:

Code: Select all

try -- to get a reference to growl
	tell application "Finder" to set growlHelperApplication to name of application file id "com.Growl.GrowlHelperApp" as string
	--tell application "System Events" to set GrowlExists to exists application process ("GrowlHelperApp" as string)
	set GrowlExists to true
on error -- Growl is not installed
	set GrowlExists to false
end try

using terms from application "GrowlHelperApp"
	tell application growlHelperApplication to notify title |title| description msg application name _appName with name (_scriptName & " " & notification)
end using terms from
I ended up using the file id because this should always work--even if growl is not currently running.
soj
Muffin
Posts: 41
Joined: Tue Aug 29, 2006 5:12 am

Post by soj »

You said:
The_Tick wrote:Hey nanovivid. When you guys get this figured out, can you add this and http://trac.growl.info/trac/ticket/324 to the applescript docs?
Where the h*** do we add the code to?
bellac
Harmless
Posts: 23
Joined: Mon Feb 28, 2005 10:20 pm

Post by bellac »

I realize that this is an old thread, but here's how I do it (and it's easily tested by turning Growl off in the preference pane):

Code: Select all

tell application "System Events" to set GrowlRunning to exists application process "GrowlHelperApp"
set Message to "So this message appears in Growl"
set altMsg to "GrowlHelperApp is not running"
Notify(Message, altMsg, GrowlRunning)

on Notify(msg, altMsg, Growler)
	if Growler then
		tell application "GrowlHelperApp"
			register as application "NoteTester.scpt" all notifications {"Note"} default notifications {"Note"} icon of application "Script Editor"
			
			notify with name "Note" title "GrowlHelperApp is Running" description msg application name "NoteTester.scpt"
		end tell
	else
		display dialog altMsg
	end if
end Notify
Locked