# Get template instance size before runtime scaling

**URL:** <https://forum.inductiveautomation.com/t/get-template-instance-size-before-runtime-scaling/20835>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [November 14, 2018, 3:40am UTC](https://forum.inductiveautomation.com/t/get-template-instance-size-before-runtime-scaling/20835 "2018-11-14T03:40:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [November 14, 2018, 3:40am UTC](https://forum.inductiveautomation.com/t/get-template-instance-size-before-runtime-scaling/20835/1 "2018-11-14T03:40:38Z")

</div>

Within a template, we can get **template original size** via `Rectangle.relWidth` on a rectangle the same size as the template with layout anchored to top, bottom, and sides.

We can get **template runtime size** into internal template properties via the following expression bindings:

```auto
runscript('self.height', 50)
runscript('self.width', 50)

```

What we’d like to get is **template instance size** in Designer. In other words, if original template was 200x200 and we stretch it to 300x150 in Designer, we want to get the 300 and 150 numbers into bindings/scripting to manipulate some things in the template. Where could we find those values?

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [November 14, 2018, 4:23am UTC](https://forum.inductiveautomation.com/t/get-template-instance-size-before-runtime-scaling/20835/2 "2018-11-14T04:23:03Z")

</div>

One way to accomplish this (assuming template runtime size is already bound to template internal properties `heightRuntime` and `widthRuntime`):

1. Add template internal property `isDesignerTesting` with binding `{[System]Client/System/SystemFlags} & 1 && {[System]Client/System/SystemFlags} & 2`.

2. Add template parameters (_not_ internal properties) for `widthInstance` and `heightInstance`.

3. Add this script to template:

```auto
if event.propertyName == 'isDesignerTesting' and event.newValue == True:
	event.source.heightInstance = event.source.heightRuntime
	event.source.widthInstance = event.source.widthRuntime

```

With all that done, flip Designer into test mode for a moment before saving to update the instance height and width parameters on all template instances open in Designer.

Is there a better or more direct way to do this?
