Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
- Subject: Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
- From: Axel Luttgens <email@hidden>
- Date: Mon, 7 Feb 2011 13:45:31 +0100
Le 6 févr. 2011 à 23:58, Kok-Yong Tan a écrit :
> I picked up a script that basically takes selected spams, processes them by expanding them with full headers to a folder on my desktop, attaches each of them to an email and sends them to a quick reporting address at spamcop.net. This used to work fine in Tiger Mail but did so very slowly. Now that I'm using the same script on Leopard (10.5.8) Mail, it works much faster (maybe an order of magnitude) but periodically (not always), it'll drop attachments. By this, I mean that if there were say, 8, attachments, it'll only attach the first to the third, drop the fourth to the seventh and attach the eighth to the email. Usually when Apple Mail is busy downloading new mail but sometimes when Apple Mail is seemingly idle according to the Activity window. I then have to manually attach the missing fourth to seventh attachments. Can anyone tell me why a script that worked perfectly in Tiger is now behaving like this in Leopard? Can anyone tell me how to fix it? Since it doesn't crash, it doesn't quite highlight in the Script Editor debugging window as to what the problem is. I've tried making it a standalone app as well as adding a delay of 2 to 3 seconds at the attachment section of the Applescript but neither seems to have helped. It can occur with 20 emails. It can occur with 5 emails. The dropouts seem to be very random.
Hello,
I couldn't reproduce those dropouts here, but I'm on 10.6.6.
Now, it seems that some operations are performed more or less asynchronously, especially the "make new attachment" one. Add to this the legendary fuzzy behavior of Mail's outgoing messages, and you've got a nice recipe... ;-)
That said, perhaps could you try a slight variant of the main loop of your script:
set counter to counter + 1
set sourceFilePath to ((theOutputFolderPath & theNewFolderName as string) & ":ml" & counter & ".src")
set thisSource to the source of thisMessage
set totalSize to totalSize + (length of thisSource)
tell me
set f to open for access file sourceFilePath with write permission
tell me to write thisSource to f
close access f
set theAttachment to alias sourceFilePath
end tell
make new attachment with properties {file name:theAttachment} at after last character of content of theMessage
delete thisMessage
and see whether you get more reliable results. At the very least, the events log should be more readable and thus possibly provide better clues about what's going wrong.
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden