I’ve created a script that works fine in Snow Leopard but for some reason fails in Lion.
The script creates a Growl notification when a file is added to the selected folder. The notification also includes the name of the file and a different notification if more than one file is added.
Here’s the script:
on adding folder items to this_folder after receiving added_items
try
set notification to “”
set fileList to (“”) as Unicode text
set notifyTitle to (“”) as Unicode text
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
set the item_count to the number of items in the added_items
repeat with thisFile in added_items
tell application "Finder"
--get the name of the folder
set the file_name to the name of thisFile
end tell
if the fileList is "" then
set the fileList to the fileList & file_name
else
set the fileList to the fileList & return & file_name
end if
end repeat
if the item_count is 1 then
set notifyTitle to "New Item in your folder"
set notification to fileList
else
set notifyTitle to "New Items in your folder"
set notification to fileList
end if
tell application "System Events"
set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
if isRunning then
tell application id "com.Growl.GrowlHelperApp"
register as application ¬
"DW Files to Email" all notifications {"Added File"} ¬
default notifications {"Added File"} ¬
icon of application "Finder"
notify with name "Added File" title notifyTitle description notification application name "DW Files to Email" icon of file this_folder sticky yes
end tell
end if
end try
end adding folder items to
Any ideas?