Yes, it's extremely simple too, just put this in your new button:
GetSizes
and that's all that is needed for the exact functionality you've described.
(it does the same thing as the existing menu command which @lxp mentions above, which even has a keyboard shortcut so maybe you don't even need to bother with creating your own button)