Am 01.04.2008 um 11:33 schrieb Jonny Taylor: That didn't change anything. Still hangs. Was there something particular you intended to achieve by rearranging things like that?
No, not really... It is just like I am trying to do similar stuff with rule-fired scripts and am having little troubles, too. I googled a working snippet that I was able to modify for my needs... Just as example for you my (mostly) working script: (does not have anything to do with yours...) <myscript> using terms from application "Mail" on perform mail action with messages actionMail for rule actionRule tell application "Mail" repeat with i from 1 to count of actionMail set thisMail to item i of actionMail set theSubject to the subject of thisMail set countNumb to my getCount(theSubject) --display dialog countNumb set theBody to (the content of thisMail) as text set theBody to my getFirstLine(theBody) set theSender to the sender of thisMail set anhaenge to mail attachment of thisMail repeat with a from 1 to count of anhaenge save item a of anhaenge in "Macintosh HD:Users:demski:Documents:" & name of item a of anhaenge end repeat end repeat end tell my openFM() end perform mail action with messages end using terms from
on openFM() tell application "Finder" to open "Macintosh HD:Applications:Ideensammlung.fp7" tell application "FileMaker Pro Advanced" do script "import" end tell delay 2 tell application "System Events" to do shell script "rm ~/Documents/Xport_*.fp7" end openFM
on getCount(theSubject) set oldTID to AppleScript's text item delimiters set AppleScript's text item delimiters to " " set Counter to text item 2 of theSubject set AppleScript's text item delimiters to oldTID return Counter end getCount <end myscript> >I use this to synchronize two Filemaker-Databases via email
BTW, I guess you don't want to do anything with the mails or their contents themselves? Did you also try to just attach the script included in your "helper" to the rule? (without the "on perform mail action... handler") I thought this handler was only necessary if working with the mail concerning things like sender, recipient, body etc.?
I've managed to work around the problem with the following construction:
using terms from application "Mail" on perform mail action with messages selectedMessages repeat with eachMessage in selectedMessages tell application "Finder" to launch application "Helper" tell application "Helper" to activate end repeat end perform mail action with messages end using terms from
I haven't worked out how to pass the content of the message to the helper app yet, which would be nice to be able to do, but I'm sure that's a solvable problem. Interestingly, the solution doesn't seem to work if "Helper" is a compiled AppleScript, but that's not critical for me.
On 31 Mar 2008, at 11:29, demski wrote:
Have you tried to put the tell-mail-block around the loop? like in: using terms from application "Mail" on perform mail action with messages selectedMessages tell application "Mail" repeat with eachMessage in selectedMessages
display alert "test alert" message "test message" as warning end repeat end tell end perform mail action with messages end using terms from
|