# Component Scripting for Template

**URL:** <https://forum.inductiveautomation.com/t/component-scripting-for-template/53344>\
**Category:** Ignition\
**Created:** [November 22, 2021, 3:03pm UTC](https://forum.inductiveautomation.com/t/component-scripting-for-template/53344 "2021-11-22T15:03:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![JoeF](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@JoeF](https://forum.inductiveautomation.com/u/JoeF)\
**Post date:** [November 22, 2021, 3:48pm UTC](https://forum.inductiveautomation.com/t/component-scripting-for-template/53344/2 "2021-11-22T15:48:13Z")

</div>

Looking at some old posts, adding the script to the template instance might not be available (?), but there are workarounds. Seems like you cannot get the event to fire at all.

One thing that I have used lately has been putting the script on the Template itself (not the template instance) that calls this potential GUI scenario and changes a component. This isn't a good code block, but it works:

```auto
currentWindow = 'Window_Path_That_Has_The_Image'
try:
	image = system.gui.getWindow(currentWindow).getRootContainer().getComponent('Image')
	image.visible = 0
except:
	pass

```

Previous posts:

> [@Mouse click on template canvas](https://forum.inductiveautomation.com/t/mouse-click-on-template-canvas/23017):
>
> Is there any work-around for lack of a mouse click event on the template canvas component?

> [@Template Event Handlers - Events in template and template instance](https://forum.inductiveautomation.com/t/template-event-handlers-events-in-template-and-template-instance/20831):
>
> I have a template created with a component that has mouseEntered and mouseExited scripts to produce a hover over effect. However I also want to be able to perform any action the developer wishes on the instance so I’ve left the template’s mouseClicked action empty. To test, I dragged on a template into a Window and wrote a simple script to write to the console into the mouseClicked event handler, but this event never fires. Is it possible to do this? Travis’ post below suggests perhaps not… b…

---

_[View the full topic](https://forum.inductiveautomation.com/t/component-scripting-for-template/53344)._
