Re: Modifying incoming mail subject
Re: Modifying incoming mail subject
- Subject: Re: Modifying incoming mail subject
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 27 Dec 2007 22:07:47 -0500
What are you setting "theMessages" to?
And you might consider using "display dialog" instead of "say", unless
of course you chose the latter due to a visual impairment.
Has: it would seem that the best way to integrate appscript
functionality with the shell would be to provide a cli that can be
called from the shell, rather than extending the shell itself..
On 12/27/07, Michaël Grünewald <email@hidden> wrote:
>
> Le 27 déc. 07 à 00:30, has a écrit :
>
> > Tip: always ensure local variable names are different to
> > application-defined keywords; syntax highlighting should help you
> > tell the difference.
>
> Thank you for that tip, this was a quite silly error ... I regret I
> did not get a sensible warning about his! 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)?
>
> > As far as bridges go, AppleScript integration is not great: see
> > osascript for shell-to-AppleScript, and 'do shell script' for
> > AppleScript-to-shell, although you'll find them rather lacking.
> > There should be a couple of basic OSA language components for sh
> > kicking around somewhere, but without integrated Apple event IPC
> > support their usefulness will be extremely limited [2]. Your best
> > bet may be Python or Ruby, which can live fairly comfortably in
> > both worlds and come with plenty of Unixy goodness already
> > included. The best Apple event bridge currently available for those
> > languages is appscript. It requires separate installation, but this
> > is pretty straightforward. See my sig. for links. (There are other
> > options as well, although they're not as good.) OSA component
> > support (needed for things like Mail rules) is still rather
> > limited, unfortunately, although a new developer release of PyOSA
> > will be out shortly which should be reasonably usable with a bit of
> > care.
>
> Thanks for these valuable information, I should pay much attention to
> ruby in the following days. My bet is that Ruby is easier to learn
> than Applescript (I have basics in many computer languages, but
> Applescript is quite disturbing --- or the guidebook quite unclear.)
>
> Back to the problem of modifying incoming emails, my script is still
> not working. To get more clues I have put a few SAY orders in the
> script:
> -- SCRIPT
> 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.
> Semantics of the code I wrote is unclear to me because I merely
> patched together lines that I found here and there on the www.
> --
> All the best,
> Micha
>
>
>
>
>
>
> ___________________________________________________________________________
> Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son
> interface révolutionnaire.
> http://fr.mail.yahoo.com
> _______________________________________________
> 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
>
--
Mark J. Reed <email@hidden>
_______________________________________________
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