This lesson is part of the Scripting in Ignition course. You can browse the rest of the lessons below.

LESSON LIST

Autoplay Off
Take topic challenge

Supplemental Videos

Description

See an introduction to the system.* Ignition scripting API.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In this lesson, we'll take an introductory look at Ignition System Library, which can be used to extend and customize Ignition's core capabilities. Python is used inside of Ignition as its scripting language. Python has many powerful built-in functions, which are grouped into libraries and, collectively, these comprise the system library, which is Ignition scripting API. As you will see, when working with the Ignition designer, oftentimes, some of the most important functions you will need come from this system library. How do we access the functions of the system library? If we're in the designer and access the script editor of some component, as we'll do with this button here, by going to scripting, the action performed event handler, and the script editor, then if we type system, dot, and then control space, then expand this a bit, we'll see this auto-completion pop-up appear. And, in it will be the list of all available sections of the system API as these library folders.

[01:07] As you can see, there are many, many different categories of system functions that can do all sorts of things. For example, system.tag has functions for reading and writing tags. System.DB allows you to interact with databases by running sequel queries. System.gooey and system.nav allow you to open, and close, and otherwise manipulate Windows. As you can see, there's a large array of capabilities here for your use. Throughout the rest of these scripting lessons, we're going to be using bits and pieces of the available scripting library, but, certainly, it's too big to cover in any one lesson. As you need to explore the system library in more detail, there are two good ways of doing so. First, you can use the indicated scripting dialogue itself. So, in any script editor, you can type system, dot, then control space, and you can click on any available library such as DB. Then, as you scroll over all the available functions, you'll see the function interface and explanation is given in a secondary pop-up auto-complete on the right.

[02:10] A second way that will give even more detail is to use the Ignition user manual itself. So, to open that up, I will go to my task bar where I have it minimized and that'll take me to the homepage of the online user manual. Then, if I scroll down to the appendices and open up the system functions, here, we'll see the documentation for all available system scripting libraries. Just as a quick aside, you won't necessarily see all of these libraries in the scripting dialogue auto complete. If certain ones don't make sense in a particular context, if we select one, say system.DB, then we'll see documentation for all the available database related functions. So, suppose we wanted to learn how to run a database query, we could just select the function system.db.RunQuery, and review its documentation, and even try out some of the provided examples, down here at the bottom.

[03:14] It's important to remember that this resource is always here for you as you're developing your scripts. Oftentimes, when you're encountering a new API for the first time, it's helpful to just kind of peruse the different functions available in it to get a clearer sense of what sorts of things are possible. So, to wrap up, we've seen that there's a richly featured system library available for your scripting needs, and two good ways to explore it, or by using the scripting window auto-complete popups, and by browsing through this online user manual.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.

close

Share this video