On Mon, Apr 23, 20079:56 AM, the following words from Rick Lecoat
[EMAIL PROTECTED], emerged from a plethora of SPAM ...

>I have an apple script (not written by me -- I have no skills in that
>arena) that is supposed to fire any time a message comes in with an
>attachment. The script writes to the attached file's Finder comments
>(are they still called Finder Comments?), making a note of who sent the
>file and the date. This is really useful because, although I also have
>had no problem with PM losing the links to attachments, I often want to
>track the other way and find out who sent a particular file in my
>attachment's folder, and when.
>
>Or, at least, it *would* be really useful if it were not for the fact
>that the script does not fire. PM appears to not activate applescripts
>if they are called automatically by a filter, as mine is (the condition
>is set to [Attachment > 0k] which I know works as a trigger because I
>also use it in another filter to set the label colour for messages with
>attachments. That other filter works fine.

Is your filter at the end of your list of filters, or where is it
located? To act on all attachments received, it would need to be at or
near the top of your list of filters. Or, at least should not follow any
scripts that move the attachments.

Does the script run properly if you manually run that filter on your
messages that have attachments? Have you tried copying the entire
contents of the script into a new script file and saving? (Don't delete
the original too quickly, but the AppleScript Editor would probably tell
you if there was a syntax error with the script you have been using, or
trying to use.)

I'm not sure if this helps, since I really don't get many attachments
that aren't spam these days to test with, but try the script below (It's
similar to a script I wrote for manual use and modified slightly for
your use.):

<Begin AppleScript>

property ret : return

to addToFileComments from {aliasList, sn, sea, stime, sub}
   set the newComment to "From: " & sn & " <" & sea & ">" & ret & "Date:
" & stime & ret & "Subject: " & sub
   tell application "Finder"
      repeat with af in the aliasList
         if the af's comment is "" then
            set the af's comment to the newComment
         else
            set the oldc to the af's comment
            set the af's comment to the oldc & ret & the newComment
         end if
      end repeat
   end tell
end addToFileComments

tell application "PowerMail"
   set the msgList to the current messages
   if the msgList is not {} then
      repeat with theMsg in the msgList
         set the msgSender to theMsg's sender
         set {the senderName, the senderEAddress} to {msgSender's
display name, msgSender's email address}
         set the msgSubject to theMsg's subject
         set the msgSentTime to theMsg's time sent as text
         set the attachmentList to theMsg's attachments

         if not the attachmentList is {} then
            set the filesToMark to {}
            repeat with attachedF in the attachmentList
               set the attachedFile to the attachedF's file
               set the end of the filesToMark to the attachedFile
            end repeat
            addToFileComments of me from {filesToMark, senderName,
senderEAddress, msgSentTime, msgSubject}
         end if
      end repeat
   end if
end tell

<End AppleScript>

Hope this helps. I don't have any scripts that trigger AppleScripts
because PM's filters fit most of my needs. I have AppleScripts that I
use manually for other instances. If you don't get a lot of attachments,
you can manually run your script, or the above script on individual
messages, or several messages at once, or even an entire folder of
messages if the script works for you outside a filter.

Good luck!

--
A nation creates music--the composer only arranges it.
-  Mikhail Glinka (1804-1857), Russian composer. Quoted in Theatre Arts
Magazine (New York, June 1958).

* MAC PRO 2 GHz Quad Xeon * OS X 10.4.9 * 3 GB Ram *


Reply via email to