Object size property in scripting

Is there a way to capture an object’s size as a property for scripting? I am building a Template canvas and do not want it to exceed the size of the canvas and add scroll bars, so I was going to script template size to be calculated based on the number of templates but do not know how to get the size of the canvas.