Thanks for your input.
It apparently is via System Events:
tell application "System Events" to click menu item "Remove Attachments" of menu "Message" of menu bar item "Message" of menu bar 1 of process "Mail"
But I haven’t even tried that as I am strongly leaning towards not removing all attachments (see my discussion about leaving smaller inline graphics in place):
See my second Update in the other topic:
Getting to that stage was what got me over the line for starting this topic.
As I’m only explicitly looking for the attachments – boundaries are missing elements found in attachments. I’m considering the parts as a flat structure and ignoring parts which don’t have attachment-relevant information for the moment. It may end up meaning there’s nothing in some hierarchical elements (i.e. no attachments between boundaries, if that makes sense).
I’m leaning towards utilising the strengths of each program in a sort of hybrid approach, and I am leaning towards importing a .mbox file at some stage. At the moment, a workable solution is better than a “most efficient” one, and I’m definitely planning on some gross inefficiencies to reduce my programming tasks (not AppleScript’s fault, I know it could do the tasks I’m going to be avoiding). More details later.
Because it’s what I’m more familiar with and more comfortable with.
Basically, I’m a dilettante, not an expert, and I go where my interests lay and where I feel comfortable.
And I think I’ll be able to get AppleScript to do what I want, despite its limitations – and I will struggle in JXA because of my own limitations.
Sean