Extracting attachments as files from Apple Mail

I am trying to create a script that extracts Sender, Subject, Message, Attachment etc. and then import data into Filemaker. I can’t figure out how to save the attached file in a variable so it can be imported into a container field in Filemaker. Any help would be appreciated.

Dave