Just wondering if anyone can help me write a script to count the number of attachments in all the emails of a folder in Entourage. I don’t need a break down per email, I just need a total of the folder.
Select a folder (make sure the selection is the folder, not the contents of the folder) and run this script:
tell application "Microsoft Entourage"
set the_selection to (get selection)
if (class of the_selection) ≠folder then return my display_dialog("Only select a single folder and run this script again.", {"OK"}, 1, 0)
set folder_name to name of the_selection
set the_count to 0
repeat with i in (get messages of the_selection whose attachments of it ≠{})
set the_count to the_count + (count (get attachments of i))
end repeat
end tell
if the_count = 1 then
set {p1, p2} to {"is", ""}
else
set {p1, p2} to {"are", "s"}
end if
my display_dialog("There " & p1 & " " & the_count & " attachment" & p2 & " in the folder "" & folder_name & "".", {"OK"}, 1, 1)
on display_dialog(m, b, db, i)
if i = 0 then beep
activate
display dialog m buttons b default button db with icon i giving up after 30
end display_dialog