HI Hiroto! many thanks for your heads up. Yes this seems to be quite solid now. I did go down the OSASCRIPT path and had some kind of results but pass parms to and from became awkward and nearly having to resort to flat files as a transfer medium between .SH and .SCPT's.
In my haste to post last night I did omit one important thing in the example code.
This is that one must add addressability/association to the MAIL.app when explicitly utilising any mail.app functions etc within the second out of line handler. (In this example it is the code associated with called
mainmail_scripthandler .
tell application "Mail"
-- do all mail.app related stuff inside or with TELL application "MAIL" to do_something
-- else one will experience some "Assertion failed errors"
end tell -- using mail.app
If this is *not done* one will still experience the *Assertion failure errors* as before.
using terms from application "Mail" -- directly called from MAIL.app rule
on perform mail action with messages bunchof_msgs_from_mailrule
(* any other set up initialisation stuff here *)
my mainmail_script_handler(bunch_of_msgs_from_mailrule) -- call out of line below
end perform mail action with messages
end using terms from
(* avoid assertion failure error messages for mail rule applescripts *)
(* move all the work from the main thread to here *)
using terms from application "Mail" -- using mail app defs
on mainmail_script_handler(bunch_of_msgs_from_mailrule)
(* put goodies here .. *)
tell application "Mail"
-- do all mail.app related stuff inside or with MAIL.app
-- else one will experience some "Assertion failed errors"
end tell -- using mail.app
return 0
end mainmail_scripthandler -- end of the main thing
end using terms from
Thanks for the further explanation Hiroto. At this stage I shall press on with this work round which seems quite robust and simple.
w
HK - looking forward to Chinese New Year soon!