In article <aanlktim-sb=uw2ope7y7igyq_hxokunp9_sudosjw...@mail.gmail.com>, Christian Prinoth <christ...@prinoth.name> wrote: > I am trying the following: > > mail=app('mail') > msgs=mail.selection() > msg=msgs[0] > > now I would like to use > msg.mail_attachments > but this won't work. If I ask for help, under elements I get the following: > > Elements: > AEType("attc") -- by name, index, relative, range, test, id > bcc_recipients -- by name, index, relative, range, test > cc_recipients -- by name, index, relative, range, test > headers -- by name, index, relative, range, test > recipients -- by name, index, relative, range, test > to_recipients -- by name, index, relative, range, test > > How do I access the attachments?
I'm not a Appscript expert but, taking a clue from an earlier answer[1] by has, it appears that there is something problematic about the 10.6 Mail.app scripting terminology. You can see also see that by trying to the ASTranslate.app tool available from the appscript web site. One way to work around it is to use the lower-level aem API to construct a reference using the raw AE codes. >>> from appscript import * >>> import aem >>> mail = app("Mail") >>> msg = mail.selection()[0] >>> msg app(u'/Applications/Mail.app').mailboxes[u'In/InMail'].messages.ID(206990 ) >>> aemref = msg.AS_aemreference.property("attc") >>> attachment = mail.AS_newreference(aemref) >>> attachment app(u'/Applications/Mail.app').AS_newreference(app.elements('mbxp').bynam e(u'In/InMail').elements('mssg').byid(206990).property('attc')) >>> attachment()[0].properties() {k.name: u'20100925_005-001.jpg', aem.AEType('attp'): u'image/jpeg', aem.AEType('atdn'): True, k.class_: aem.AEType('attc'), aem.AEType('atsz'): 387441, k.id: u'2'} Hope that helps. [1] http://permalink.gmane.org/gmane.comp.python.apple/14658 -- Ned Deily, n...@acm.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG