Help Needed with applescript – antispam

Discussion in 'Mac Programming' started by GuyPaterson, Feb 17, 2007.

  1. GuyPaterson macrumors newbie

    Feb 17, 2007
    Hello there,
    I downloaded a applescript from to automatically forward spam to the authorities within Entourage. It does this OK, but there were a couple of things I wanted to add to it to improve it's efficiency and save me hours of wasted time! The problem is I have no experience/knowledge of applescript, after several hours of trying to modify it I have had no success. I have emailed the guy who originally wrote it, but this was back in 2003 so am not holding my breath for a reply! I wondered if anyone here might be able to help.

    The script is for Microsoft Entourage.

    Here is the script:


    tell application "Microsoft Entourage"

    -- get the currently selected message or messages
    set selectedMessages to current messages

    -- if there are no messages selected, warn the user and then quit
    if selectedMessages is {} then
    display dialog "Please select a message first and then run this script." with icon 1
    end if

    repeat with theMessage in selectedMessages

    -- get the information from the message, and store it in variables
    set theName to subject of theMessage
    --This grabs the headers and content of the spam message
    set msgSource to source of theMessage

    --"spam" is a contact with addresses to forward spam to, such as
    --change "spam" to your own email address for testing
    set spamReportAddress to "spam"

    set newM to forward theMessage to spamReportAddress without opening window and html text

    set spamReportNote to "This SPAM message was sent to me:

    set the content of newM to (spamReportNote & msgSource)

    set the subject of newM to ("FWD SPAM: " & theName)
    --set the to recipient of newM to ""

    --Don't forward the attachments
    delete the attachments of newM

    --Optional, if you want to see the SPAM report first before sending it
    open newM

    --Go Ahead and Send the SPAM report (uncomment this and comment out above line)
    --send newM

    --Delete the original SPAM message(uncomment)
    --delete theMessage
    end repeat

    end tell

    (have also attached file)

    The 2 additional tasks I wanted it to do (in this order) were:

    1. Ignore spellcheck and send which works in this order:

    spelling > cancel > send

    2. Automatically delete th original message

    Be massively appreciative of anyone who can help.



    Attached Files:

  2. elfin buddy macrumors 6502a

    elfin buddy

    Sep 16, 2001
    Tuttlingen, Germany
    I'd try to help you, but I don't own a copy of Entourage to toy with. Have you tried looking at the Entourage AppleScript dictionary? (I assume it has one)

    In the Script Editor program, go File --> Open Dictionary... and choose Entourage. It should list application-specific commands you can use to help you make your script work the way you want it to.

Share This Page