- Code: Select all
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 & ", " & file_name
end if
end repeat
if the item_count is 1 then
set notifyTitle to "New Item in " & the folder_name & " folder"
set notification to fileList & " has been added to " & the folder_name & " folder."
else
set notifyTitle to "New Items in " & the folder_name & " folder"
set notification to fileList & " have been added to " & the folder_name & " folder."
end if
tell application "System Events"
if (application processes whose name is "GrowlHelperApp") is not {} then
tell application "GrowlHelperApp"
register as application ¬
"Folder Actions" all notifications {"Added File"} ¬
default notifications {"Added File"} ¬
icon of application "Finder"
notify with name "Added File" title notifyTitle description notification application name "Folder Actions" icon of file this_folder with sticky
end tell
end if
end tell
end try
end adding folder items to
Now I want to take this one step further: When I click on this notification, I'd like to open that folder in Finder so that I can go straight to that folder and see what was placed there. I know there is AppleScript available to open Finder to a certain folder and I know that within Adium, you can click on a Growl notification when you receive a new message and it'll bring you to that chat window (i.e. bring it to the front). So is there a way to do this? If you don't understand the question, let me know and I'll try to clarify. Thanks.
