folder action with growl notification?

Hi, I’m wondering if it’s possible to attach a folder action script to an “inbox” folder that would trigger a growl notification after a file has been in the folder for a set period of time, in my case a week and then for every day following, until the “offending” file is moved from the folder.

I’m a complete noob at scripting and not even sure if this is within the purview of applescript. If applescript can’t time the event, then just a simple growl notification script that I could trigger through Hazel would work too. If someone can help me out that’d be great or at least point me in the right direction. I’m willing to pay (some small-ish amount) for the help.

Thanks

Model: 2 GHz Intel Core Duo
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061024 BonEcho/2.0
Operating System: Mac OS X (10.4)

You would use folder actions to put a (date moved in folder, and put it in the spotlight comment or a log file.) Then have a second stay open applescript application that runs at set time that check the date in comment then moves and report where needed.

I don’t know growl notification, if you can applescript it, i’ve download it to play with. A simple mac dialog would be easier.

Better brief, and I’ll write it for you.

The answer is yes, it’s easy to script the GrowlHelperApp. As bevos points out, however, the condition “after a file has been in the folder for a set period of time” is not Folder Action stuff, it’s stay-open application ‘on idle’ stuff.

An example:


on Growl_It(gTitle, gMessage)
	tell application "GrowlHelperApp"
		notify with name "Next4BD" title gTitle description (return & gMessage) application name "Birthdays" with sticky
	end tell
end Growl_It

Before you can post notifications with Growl however, you have to register the posting script or application with Growl. That can also be done with an AppleScript.

Here’s the ‘generic’ registration:


tell application "GrowlHelperApp"
	-- Make a list of all the notification types 
	-- that this script will ever send:
	set the allNotificationsList to ¬
		{"Next4BD", "All_BD"}
	
	-- Make a list of the notifications 
	-- that will be enabled by default.      
	-- Those not enabled by default can be enabled later 
	-- in the 'Applications' tab of the growl prefpane.
	set the enabledNotificationsList to ¬
		{"Next4BD", "All_BD"}
	
	-- Register our script with growl.
	-- You can optionally (as here) set a default icon 
	-- for this script's notifications.
	register as application ¬
		"Birthdays" all notifications allNotificationsList ¬
		default notifications enabledNotificationsList ¬
		icon of application "iCal"
end tell

This only has to be done once, but there’s no harm in doing it every time the script runs.

Thanks! I’ll try these out and let you know if it doesn’t work!

Model: 2 GHz Intel Core Duo
Browser: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061024 BonEcho/2.0
Operating System: Mac OS X (10.4)