• Re: mail.app and applescript rule - Not workinh - help?

    From Sander Tekelenburg@user@domain.invalid to comp.sys.mac.apps,comp.sys.mac.system,alt.comp.lang.applescript on Saturday, July 26, 2003 06:08:03
    From Newsgroup: comp.sys.mac.system

    [Crossposted and followups set to <news:alt.comp.lang.applescript>]

    In article <3F2194F7.2010204@nospam.com>,
    mark hune <mark.hune@nospam.com> wrote:

    Hi, I have been trying to get the mail.app to run a compiled applescript when an email arrives with a certain subject.

    i.e...


    RULE:
    if [any] of the following conditions are met:

    [subject] [contains] 'ipsender'


    perform the following actions:

    [Run Applescript] '~/Library/Scripts/Applications/Mail/ipsender0.scpt'


    Nothing happens when the mail arrives, but if I run the script
    externally it works a treat?

    I don't use Mail.app so I can't say much about that aspect. (Does it
    actually run compiled scripts or might it requiere applets?) But I can
    imagine that the way you refer to the message works in one way, but
    doesn't in the other. Hard to say when you don't post the actual code.

    In general, the approach to trouble shoot code is to wrap your it in a
    try handler and have it inform you of the error message and number. For instance something like this:

    try
    -- do stuff
    on error m number n
    tell app "Finder"
    activate
    display dialog (n as string) & return & (m as string)
    end
    end

    Or write the error to a log. Whichever you prefer.

    You may have to do that on every line of your code before you actually
    catch the problem.


    [Note follow-ups]

    --
    Free and shareware at <http://www.euronet.nl/~tekelenb/software/>
    --- Synchronet 3.18b-Win32 NewsLink 1.113