• 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: Modifying incoming mail subject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modifying incoming mail subject


  • Subject: Re: Modifying incoming mail subject
  • From: Ed Stockly <email@hidden>
  • Date: Fri, 28 Dec 2007 08:47:35 -0800

>>>>By the way, is there any  facility in the script editor that can help one to spot its mistake (e.g. a list of variables used in a script can let one spot spelling   errors)?


There is, not a list of variables, for that you would need ScriptDebugger, but set your script so your variable are all colored bright red, and stand out very clearly, and applications keywords are a different font and/or color to make it easier to distinguish. (Preferences>Formatting)


using terms from application "Mail"

    on perform mail action with messages theMessages for rule theRule

        tell application "Mail"

            say "Hello"

            set text item delimiters to "[Caml-list] "

            repeat with eachMessage in theMessages

                say "This goes on and on"

                set theSubject to the subject of eachMessage

                set theAnswer to ""

                repeat with thePart in text items of theSubject

                    set theAnswer to theAnswer & thePart

                end repeat

                set subject of eachMessage to (theAnswer)

            end repeat

        end tell

    end perform mail action with messages

end using terms from

-- SCRIPT


When I ask Mail to apply rules, I can hear the "hello" that let me  

know the script is triggered, but there is no iteration of the loop.


Someone else already suggested using display dialog rather than say. Good advice, in addition, when running the script from the script editor you should open the apple event log and, to check the value of a variable a point in the script enter the command

log variableName

As for the script not entering the repeat loop, it's behaving as if theMessages is a list of 0 items {}.

Try this

log class of theMessages
log count of theMessages

That will tell you if theMessages is indeed a list and how many items are in the list.

HTH,

ES

=
 _______________________________________________
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

  • Prev by Date: Re: Safari Scripting Help (Newbie help)
  • Next by Date: Re: Automated sending of emails
  • Previous by thread: Re: Modifying incoming mail subject
  • Next by thread: Organizing AppleScripts
  • Index(es):
    • Date
    • Thread