I usually just tell them up front I have a lot of medicine since it probably isn't all going to fit into that little bag of liquid stuff you're allowed. They probably will make you pull it all out and send it through the machine outside of your bag. To me it's rather embarrassing to have to pull all that medicine out of my carry on with people all around, but most of the security people have been very nice. Once a lady got ugly with me and tried to tell me I couldn't take it all. I just stood my ground and told her there was no way it was being checked, and eventually she backed down. They can't stop you from taking medicine with you and certainly don't want to be responsible for the results if they make you check it and then the airline loses it.
As far as the machine, that usually gets a separate scanning as well, and they always take it out of the carrying bag I use for travel to look at it. Nobody has ever questioned it, though, once they realize what it is.