![]() |
Quote:
|
|
Quote:
Don't forget I only said it was very probable, not highly probable. :) |
Finally dumped out an mbox with lots of attachments, then sliced and diced in Terminal to see what was happening. Main problem seems to be an inconsistency about how different clients put together email headings; I doubt you will ever get an accurate count of how many files Mail will extract without examining each message separately.
The good news is you don't really need a full count, and our checks *are* actually working! Turns out the result of this expression grep -i "name=\".*\"" "/path/to/mbox" was all "name=" tags from the Content-Type headers and all "filename=" tags from the Content-Disposition headers, 445 total...and nothing else (I was afraid it would match attributes in html parts). If *any* of these are matched, it should indicate an attachment that Mail can save. So you should be able to do a test like tcount=`grep -i -c "name=\".*\"" "/path/to/mbox"` if test $tcount -ne 0 then #run save script for mail box here fi or in Applescript... set tcount to do shell script "grep -i -c \"name=\\\".*\\\"\" \"/path/to/mbox\"" if tcount is not "0" then --run save script for mail box here end if Btw, the regular expression "name=\".*\"" is simply looking for "name=" followed by zero or more characters surrounded by double-quotes, which is why it also finds "filename="???"". Best regards, Brad |
1 Attachment(s)
Quote:
well when i looked before i didnt see anything on attachments there is as you say an attachment section ill play around with the commands that are listed tomorrow, though there is no obvious command to read the number of attachments anyway, ive attached a screen shot of the dictionary |
Quote:
that wasnt really the point, the point was we were trying to get an accurate read, and it was fun trying to do it plus if it was accurate, the script would never fail, with an aprox count, there will be very rare occationsions when it will sorry its just the perfectionist in me, im like a lion with a kill, i wont let it go till ive had my fill :D my web sites are like that too and i get told off for it, they tell me if its working dont try to fix all the bugs, just move on to the next one, but i like to build sites with no bugs, then i dont have to find out what some idiot has done later to make the site fail ho hum, anyway, if you have any other thoughts i would be happy to hear and test them..... ive had jaguar now for about 2 years i think at the start i was told you could not wake a computer from energy saver sleep with actionscript, 2 years later im reporting and bouncing spam while im asleep :D o/s x is much more powerful than o/s 9 there probably is an answer, we just havent found it yet sweet dreams hitting the hay |
Quote:
You might also be able to tackle this with procmail, I'm not sure (not much of a Perl or procmail expert). Alternatively, you could set up a mail server (MTA) to deal with the attachments when they arrive with the email. My exim server writes the extension of each attachment into an additional header, so I can see how many and what type of attachments are there from looking at the log, before ever opening the email. It's certainly possible, but may be a lot of work! |
Quote:
ok, i guess we just have to leave it as aprox, at least until i get panther or tiger, or one of those commands for mail as dictionary attachments actually reads the number. i dont mind work, but theres no point in doing a lot of work for something that kinda works, at least i can do some sort of test :) as for perl, i used to have it working in o/s 9, but ive never managed to work out how to use it in o/s 10, or php for that matter :( thx again |
| All times are GMT -5. The time now is 05:46 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.