# How to run event scripts

**URL:** <https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295>\
**Category:** Ignition Early Access\
**Created:** [March 13, 2019, 12:29pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295 "2019-03-13T12:29:34Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 13, 2019, 12:29pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/1 "2019-03-13T12:29:34Z")

</div>

OK, i know that this question sounds ridiculous. But I’m really confused. I’m testing the ignition 8 Beta and its Perspective module. So I made some simple window, simple label and simple button. I added one custom property to button called ‘val’.  
I made binding Label.props.text and Button.custom.val. It’s working (yay!)  
And now I made the script in button. Like this: Configure Events… -\> onClick -\> add -\> Script. My script is also very simple. It’s:  
self.custom.val = 10.  
And its not working. I tried to make "print ‘10’ " but the console output remains empty.  
What makes me more confusedI made the script in the button “system.perspective.setTheme(‘dark’)”. And it’s also not working, but the direct onClick -\> add -\> Theme, setting ‘dark’ is fine. I feel like the Ignition is ignoring my scripts without even a single error message. So the question is: am I doing something wrong or is this some kind of strange error?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 13, 2019, 12:39pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/2 "2019-03-13T12:39:46Z")

</div>

> [@Piotr.Olejnik](#):
>
> I tried to make "print ‘10’ " but the console output remains empty.

Look in the gateway logs. Perspective scripts run in gateway scope.

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 13, 2019, 12:55pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/3 "2019-03-13T12:55:05Z")

</div>

the script:  
print “test!”  
and i have this in log:  
Unable to run function “runAction(self, event)”, code could not be compiled.  
☹

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 13, 2019, 12:55pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/4 "2019-03-13T12:55:07Z")

</div>

“print” output won’t show up in the gateway web interface logs… only in the actual wrapper log.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 13, 2019, 2:08pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/5 "2019-03-13T14:08:53Z")

</div>

Cold you post a screenshot of the entire Script Editor window where you’re writing the script, along with the exact message from the gateway logs?

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 14, 2019, 6:03am UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/6 "2019-03-14T06:03:59Z")

</div>

Sure,

 ![Screen1](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/29a47fe7546ce7a198510ba20c55ea1eb3ed204b.png)  
 ![Screen2](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0cc9e9ca0f8cc7bfbb6e06863fb8ee4a7756f301.png)

And errors:

 ![Screen1err](https://us1.discourse-cdn.com/inductiveautomation/original/2X/a/a35475ee4426a6d58dc6941ca98ca2e604f4ce9a.png)  
 ![Screen2err](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8e39873c9eb2fca64de88e3fc9a4b083f83c8bc3.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 14, 2019, 12:32pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/7 "2019-03-14T12:32:42Z")

</div>

Did you type some spaces instead of use a tab?

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 14, 2019, 12:48pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/8 "2019-03-14T12:48:35Z")

</div>

It’s tab, not spaces… Btw, I didn’t type anything, this is default place where the “# Write your script here” is. So You mean that it should work, but it’s not for some reason?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 14, 2019, 12:50pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/9 "2019-03-14T12:50:24Z")

</div>

It should work then 😕

If you create a new script and leave that “# Write your script here” text in and just start below it does it work?

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 14, 2019, 12:57pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/10 "2019-03-14T12:57:04Z")

</div>

Unfortunately, it does not help

Even when I run empty script I have error in gateway logs 😕

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 14, 2019, 1:00pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/11 "2019-03-14T13:00:29Z")

</div>

Can you tell us what version of Windows you’re using, any locale information, what version of the beta this is, and maybe upload a gateway backup or just a zip file containing the `data/projects` directory?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [March 14, 2019, 2:28pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/12 "2019-03-14T14:28:40Z")

</div>

Or also try this trick to give us some additional insight: Select the View node in the Project Browser (not the root node, but the node you actually supplied a name to, like “MyView”). Hold down Shift and then right-click the View node, and select Copy JSON. Paste your clipboard into your preferred text editor, save this content as “\<view\_name\>.json”, and post that file for us.

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 15, 2019, 5:41am UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/13 "2019-03-15T05:41:58Z")

</div>

Sure, So it goes like that:  
OS for Server: Windows 7 Professional, Version 6.1, Compilation 7601 Service Pack 1  
OS Designer: Windows 10, Version 1803, Compilation 17134.648  
Ignition Version: 8.0.0-beta0 (b2019030802)  
I noticed something weird: the processor in server is Intel Xeon E3-1220 v2, but in gateway status I see OS as “Windows 7 | amd64”

This is link to Gateway backup, and window saved as JSON file: [https://mega.nz/#F!3kUwAabJ!bsHjSfYLSPwamaGd4ZOdgQ](https://mega.nz/#F!3kUwAabJ!bsHjSfYLSPwamaGd4ZOdgQ). I will keep this valid for at least a month or two

And one more thing is that we installed Ignition 8.0, by overwriting existing Ignition 7.8.5 gateway

Can I provide You any other informations? 😉

---

<div class="post-metadata">

**Author:** ![Piotr.Olejnik](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Piotr.Olejnik](https://forum.inductiveautomation.com/u/Piotr.Olejnik)\
**Post date:** [March 18, 2019, 12:25pm UTC](https://forum.inductiveautomation.com/t/how-to-run-event-scripts/23295/14 "2019-03-18T12:25:34Z")

</div>

OK, last update fixed the problem 🙂
