# Scripting libraries for V8 and V7.9

**URL:** <https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125>\
**Category:** Ignition Early Access\
**Created:** [January 25, 2019, 6:05pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125 "2019-01-25T18:05:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 25, 2019, 6:05pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/1 "2019-01-25T18:05:08Z")

</div>

Hi,

I see that there is a significant difference in the scripting libraries such as tag library between version 8 and version 7.9 (V7.9 has more functions than V8).

Also , why are readAll and writeAll functions not provided in V8. They are supposed to be faster for group of variables., then how to read/write a bunch of tags in one go in V8?

Also the documentation such as sample code etc are missing in V8. Is it under preparation/updation!

---

<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:** [January 25, 2019, 6:12pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/2 "2019-01-25T18:12:41Z")

</div>

`readAll` and `writeAll` still exist, but they are hidden (this is how deprecate scripting functions).

They’ve been replaced by `readAsync`, `readBlocking`, `writeAsync`, and `writeBlocking`, all of which accept multiple tag paths.

These functions are all documented in the Designer and in the [beta manual](https://docs.inductiveautomation.com/display/DOC80/system.tag.readBlocking).

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 26, 2019, 4:05am UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/3 "2019-01-26T04:05:12Z")

</div>

Ok, however for older versions \<8.0, the asyncRead/Write functions will not exist , so do we have to use the readAll/writeAll functions, or will the Async versions also be supported in older versions as well? Do we have to maintain two versions of our scripts for v8 and \<8? What's the suggestion?

regards

---

<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:** [January 26, 2019, 1:16pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/4 "2019-01-26T13:16:40Z")

</div>

Up to you I guess. I think we’d expect you to just use the right function for the version of Ignition you’re on.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 26, 2019, 4:34pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/5 "2019-01-26T16:34:13Z")

</div>

Which scripting function in **system.tag** libraries allow reading the tag properties such as:

**General properties, Numerical properties, Metadata properties, Permission properties, Alarm properties, etc** (I am mainly interested in the meta data such as engg units, documentation, format for display etc).

Is there a way to identify from the tag values read using **tag read scripts** , if a tag is in **alarm state** and in which state is it now (without having to assign scripts to tag alarm events). In other words, I should be able to get initial value of a tag's alarm state (active, acknowledged, reset).

Also instead of assigning a script to alarm event of a tag manually from the designer, is there a way to subscribe an an alarm event for a given tag(s) thru script?

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [January 28, 2019, 9:06pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/7 "2019-01-28T21:06:46Z")

</div>

> [@prafull\_j](#):
>
> Which scripting function in **system.tag** libraries allow reading the tag properties such as

[https://docs.inductiveautomation.com/display/DOC80/system.tag.getConfiguration](https://docs.inductiveautomation.com/display/DOC80/system.tag.getConfiguration)

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [January 29, 2019, 6:48am UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/8 "2019-01-29T06:48:04Z")

</div>

Thanks a lot Ryan. However the V8 library seems to be different from 7.9 , which was more complete with examples. Hopefully V8 documentation will also be updated with examples soon!

While this gives the static configuration details of tags as well as including alarm configuration details, however how to get alarm status for tags (whether in alarm state, ack, reset state) and get alarm triggers?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 25, 2019, 6:50am UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/9 "2019-02-25T06:50:49Z")

</div>

**import json** doesn't seem to work in python scripts version 7.9 of Ignition where as in version 8.0 its working fine! in 7.9 it gives - **ImportError: No module named json??)**

Is that so or am I missing some thing?

---

<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:** [February 25, 2019, 12:15pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/10 "2019-02-25T12:15:56Z")

</div>

The JSON module doesn’t exist in 7.9. We upgraded from Jython 2.5 to 2.7 in Ignition 8.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [February 25, 2019, 12:18pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/11 "2019-02-25T12:18:36Z")

</div>

On 7.9, you need to use [`system.util.jsonDecode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonDecode) and [`system.util.jsonEncode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonEncode).

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 25, 2019, 12:49pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/12 "2019-02-25T12:49:34Z")

</div>

> [@Kevin.Herron](#):
>
> The JSON module doesn’t exist in 7.9. We upgraded from Jython 2.5 to 2.7 in Ignition 8.

Thanks a lot Kevin for the confirmation. One more doubt, I hope the read file read and read tag script functions are synchronous in both versions (8 and \<8). They seem to be so to me right now, but I hope they will continue to be supported in version 8+, so that our scripts works across \>8 and \<8 versions without any change?

> [@Sanderd17](#):
>
> On 7.9, you need to use [`system.util.jsonDecode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonDecode) and [`system.util.jsonEncode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonEncode).

Thanks a lot [Sanderd17](http://forum.inductiveautomation.com/u/sanderd17) for the hint, but I used the "ast" module and got it working. Hope its ok to use this as well? Or do you see any problems with it and suggest your suggested libraries?

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 26, 2019, 10:20am UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/13 "2019-02-26T10:20:41Z")

</div>

I observe that system.date.now function is not supported in Ignition 7.7. Also the documentation for Ignition is give from Ignition version 7.8, 7.9 and 8. Can we assume that 7.7 and lower versions will not be required to be supported? I am just trying to ensure that my scripting modules work on older versions as well? Whats the minimum version that should test for?

---

<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:** [February 26, 2019, 1:15pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/14 "2019-02-26T13:15:44Z")

</div>

You decide for yourself what versions to support. v7.7 is an LTS, so I support that. I will support v7.9 for a long time for the same reason. I also support v7.8 because it is easy, being between two versions I do support.

---

<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:** [February 26, 2019, 1:38pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/15 "2019-02-26T13:38:29Z")

</div>

FWIW, 7.7’s LTS period expires in July 2019.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 26, 2019, 1:58pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/16 "2019-02-26T13:58:45Z")

</div>

Thanks a lot all of you. Only challenge is that we need to test our scripts on all the versions to ensure they really work. e.g. **import json** was not supported in version 7.9 so we had to find an alternative solution. Similarly the **system.date.now** function doesn't seem to be present in 7.7.Perhaps testing for a lower version of Ignition will ensure upward compatibility, unless higher versions of python library deprecate some of the previous version functions (e.g. some functions are replaced with their asynchronous versions e.g. file reads or tag reads etc, in that case we need to redesign the modules, unless the synchronous versions are still supported.

I think its best to test for each major version to ensure things are working.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [February 26, 2019, 6:44pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/17 "2019-02-26T18:44:49Z")

</div>

> [@Sanderd17](#):
>
> On 7.9, you need to use [`system.util.jsonDecode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonDecode) and [`system.util.jsonEncode`](https://docs.inductiveautomation.com/display/DOC79/system.util.jsonEncode).

This doesn't seem to work! ast.literal\_eval works fine!

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [March 4, 2019, 5:59pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/18 "2019-03-04T17:59:48Z")

</div>

Scripting supports the windows (awt) and timer events. How can we add our own event listeners in scripting?

---

<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 4, 2019, 6:15pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/19 "2019-03-04T18:15:26Z")

</div>

> [@prafull\_j](#):
>
> How can we add our own event listeners in scripting?

Implement the functionality in a jython class that extends the appropriate `Adapter` class and overrides the methods of interest. Add instances of that class to your components using the corresponding `.add***Listener()` method.

---

<div class="post-metadata">

**Author:** ![PRAMANJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pramanj/32/66935_2.png) [@PRAMANJ](https://forum.inductiveautomation.com/u/PRAMANJ)\
**Post date:** [March 5, 2019, 5:35pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/20 "2019-03-05T17:35:27Z")

</div>

> [@pturmel](#):
>
> overrides the methods of interest.

jython class created , extending the adapter class. However how to override the methods of the class that extends the Adapter class? By simply redefining these abstract?

---

<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 5, 2019, 5:46pm UTC](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125/21 "2019-03-05T17:46:01Z")

</div>

> [@prafull\_j](#):
>
> By simply redefining these abstract?

No, just implement the method in jython. If there are multiple signatures for a method in java, the one method will override all of them. You'll have to leverage \*args and check argument types yourself to re-implement all of them.

Event Adapter types generally don't have that problem, so you just implement the methods of interest.

[Next page](https://forum.inductiveautomation.com/t/scripting-libraries-for-v8-and-v7-9/22125.md?page=2)
