HI
I have completed the script below which takes whatever is selected in the Finder and attaches it to a new Entourage mail message. It uses Growl and has a few warnings in case you accidentally select too many files. Hopefully others will find it useful. I have it set to a trigger in Quicksilver to speedily attach stuff to Entourage mail messages.
I would like to do the equivalent for Apple Mail. But I am having trouble making the bit that brings the attachment into the Mail message work. Could someone suggest a bit of code to replace the Entourage code in this regard? Any help much appreciated.
Thanks
tell application "Finder" to set the_selection to the selection as alias list
set theCnt to count of the_selection
if theCnt is 0 then
beep
my notify(theCnt, 3)
else if theCnt < 10 then
my notify(theCnt, 1)
tell application "Microsoft Entourage"
open the_selection
activate
end tell
else if theCnt > 9 then
beep
my notify(theCnt, 2)
try
tell me to activate
tell me to display dialog "Are you sure you want to attach " & (theCnt as text) & " files?" buttons {"Cancel", "OK"} default button 1 with icon 2 giving up after 15
on error e number n
if n = -128 then -- user cancelled
beep
my notify(theCnt, 4)
return
end if
end try
if gave up of result then
beep
my notify(theCnt, 4)
else
my notify(theCnt, 1)
tell application "Microsoft Entourage"
open the_selection
activate
end tell
end if
end if
on notify(numberfiles, startfinish)
tell application "GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Attach", "Warning", "Error", "Abandon"}
-- 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 ¬
{"Attach", "Warning", "Error", "Abandon"}
-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application ¬
"FinderToEntourage" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Microsoft Entourage"
-- Send a Notification...
if startfinish = 1 then
notify with name ¬
"Attach" title ¬
"ATTACHING" description ¬
"PROCESSING " & (numberfiles as text) & " FILE(S)" application name "FinderToEntourage"
else if startfinish = 2 then
notify with name ¬
"Warning" title ¬
"ARE YOU SURE?" description ¬
"YOU HAVE SELECTED " & (numberfiles as text) & " FILES IN THE FINDER" application name "FinderToEntourage"
else if startfinish = 3 then
notify with name ¬
"Error" title ¬
"E R R O R E R R O R" description ¬
"NO FILES SELECTED - TRY AGAIN" application name "FinderToEntourage"
else if startfinish = 4 then
notify with name ¬
"Abandon" title ¬
"OPERATION ABORTED" description ¬
"NO FILES ATTACHED" application name "FinderToEntourage"
end if
end tell
end notify