My first script <blush>. Help?

Hi guys :slight_smile:

You’ve been very welcoming, so I venture to ask for some advice. Please be patient with my ignorance. I’m ploughing my way through some tutorials, and trying to use what I discover.

Every day SpamSieve puts most of my spam in an Apple Mail folder called Spam . I then spamcop it by forwarding each message separately. It’s very time-consuming. Just the job for AppleScript!

It should be a very simple script, since I have SpamSieve working so well, that I haven’t had any false positives for ages. What goes in that box is spam. I know my spamcop submit address. All I need is to put them together.

I think possibly I’m not defining enough: it’s hard to tell with AS. It seems to know so much about the system and the applications, that I have trouble working out what I need to define, and what I don’t.

My current effort aims to spamcop each msg in the Spam folder, then move them to the Trash mailbox. It compiles, it runs, when I select it from the Mail scripts menu, I don’t get an error msg, but I don’t get any action, either. I’m getting muddled. If you have time and inclination to offer some advice, I would very much appreciate it. Thankyou. :slight_smile:

My script at this stage (the correct address is where I have "my spamcop address):

on run
tell application “Mail”
if message is in mailbox = “Spam” then
forward message
set address of outgoing message to “my spamcop address”
send message
delete message
repeat until number of messages in mailbox “Spam” is 0
end repeat
end if
end tell
end run


I am not familiar with Mail so I could not do anything beyond just glancing at your codes. Offhand, your codes are outside the repeat loop so basically, your repeat loop isn’t doing anything.

Try putting your codes inside the repeat loop and see what happens. You should set your codes to keep working in the repeat loop until the content of the spam folder is empty.

Good luck!


Check out our ScriptBuilders section, there are a few scripts there that may help…

Thanks for the tips. I had a good look at those scripts, but the two that spamcopped spam refused to answer unless I fed them Eudora (which I didn’t have) or Entourage (retch) respectively. So I’m not really any further on. :frowning:

I did manage to get Mail to do something with my script: go into an infinite loop. I’m not really sure that is progress…

Back to the tutorials. I think even this script, which I think should be relatively simple, is way beyond what I can do at this stage. :frowning:

from Clytie, discouraged (then again, I’m crooker today., might be able to get back to it when I’m not)