I'd be interested to see this if you get it to work, personally I think it's going to be difficult to do with an action, if you had the complete frame it would be easy enough, but getting it to create the frame may be tricky. Maybe a script would be easier in the long run? not sure.
Wayne