Index > Scribe > deleting attachments from script | |
---|---|
Author/Date | deleting attachments from script |
scott 12/06/2010 7:47pm | I'm trying to create a script that will delete attachments named *.vcf or winmail.dat. So far, I've got it so that it will print the names of attachments that meet the criteria, but it won't delete them. Here's the code:
for (n=0; n<Mail.Attachments; n++) { a = Mail.Attachment[n]; if (Strstr(a.name, ".vcf") >=0 || Strstr(a.name, "winmail.dat") >= 0) { Print("Delete: " + a.name + " from " + Mail.From.Name + "\n"); Delete(Mail.Attachment[n]); } } Why aren't the attachments deleted? |
fret 13/06/2010 3:34am | 'Delete' is the system function that free's a scripting struct object from memory, 'DeleteThing' will free a Scribe object... you want 'DeleteThing'. |
fret 13/06/2010 3:52am | One other thing... DeleteThing will decrease the value of Mail.Attachments, so you'll probably want to do 'n--;' as well after the DeleteThing. |
Scott 15/06/2010 12:57am | works like a charm -- thanks for the help |
Reply | |