Skip to content

Instantly share code, notes, and snippets.

@sunny
Created January 27, 2010 14:29
Show Gist options
  • Save sunny/287871 to your computer and use it in GitHub Desktop.
Save sunny/287871 to your computer and use it in GitHub Desktop.
-- Place this in "/Library/Scripts/Folder Action Scripts/" then add it to the folder actions
-- to receive a Growl notification whenever a new file appears
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set the folder_name to the name of this_folder
set the item_count to the number of items in the added_items
set first_file_name to the name of the first item in added_items
end tell
if the item_count is greater than 1 then
set alert_message to (the item_count as text) & " new items in " & the folder_name
set alert_description to ""
else
set alert_message to "One new item in " & the folder_name
set alert_description to first_file_name
end if
tell application "GrowlHelperApp"
register as application "New File Notifier" ¬
all notifications {"New File"} ¬
default notifications {"New File"}
notify with name "New File" ¬
title alert_message ¬
description alert_description ¬
application name "New File Notifier" ¬
icon of file this_folder
end tell
end adding folder items to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment