• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Kok-Yong Tan <email@hidden>
  • Date: Mon, 7 Feb 2011 23:25:26 -0500


On Mon, Feb 7, 2011, at 12:14, Kok-Yong Tan wrote:

On Mon, Feb 7, 2011, at 07:45, Axel Luttgens wrote:

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


Many thanks, Axel. I've typed it in and it seems to run fine after I corrected the variable "sourceFilePath" above to "sourceFile" as the former isn't defined. As I mentioned in my original email, even with Leopard 10.5.8 Mail, the dropouts only happen sporadically so it's not a consistently reproducible problem (which makes debugging all that much harder). I'll try running your version for a while from within the Script Editor for debugging purposes and see if the same problem crops up again. I'll report back over the next couple of weeks or so.

Tan

Okay, reporting back as promised. Initial runs of the above script seemed to work although it ran really, really, really slow--about the same speed as when it was run in Tiger Mail. Then just five minutes ago, running with 5 spams selected resulted in it dropping spams 3 and 4 which I had to manually add in. I guess it didn't help. Running it again against the same 5 spams by moving them from Trash to my Spam folder resulted in it attaching spams 1, then 3-5 but dropping spam 2. Different runs caused different results in the attachment process. It always seems to be the attachment process--when I check the temporary files, they are sitting there ready to be attached. Instead of having them all attach on the fly, I'm going to try processing them all then coming back and attaching them in another separate loop by itself.


--
Reality Artisans, Inc. # Network Wrangling and Delousing
P.O. Box 565, Gracie Station # Apple Certified Consultant
New York, NY 10028-0019 # Apple Consultants Network member
<http://www.realityartisans.com> # Apple Developer Connection member
(212) 369-4876 (Voice) # My PGP public key can be found at <https://keyserver.pgp.com>





_______________________________________________ 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
  • Follow-Ups:
    • Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
      • From: Axel Luttgens <email@hidden>
References: 
 >SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard (From: Kok-Yong Tan <email@hidden>)
 >Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard (From: Axel Luttgens <email@hidden>)
 >Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard (From: Kok-Yong Tan <email@hidden>)

  • Prev by Date: Suddenly Seeking a BBEdit AppleScript Developer
  • Next by Date: Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
  • Previous by thread: Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
  • Next by thread: Re: SpamCop script which worked in Tiger suddenly dropping some attachments in Leopard
  • Index(es):
    • Date
    • Thread