Description

Learn how to write event scripts that fire on the Client when a user performs a certain keystroke.

Video recorded using: Ignition 8.1

Transcript

(open in window)

[00:00] In an Ignition Vision Client, you can have scripts run whenever a certain key combination is entered at the keyboard. In this lesson, we'll demonstrate how to use the client event scripts keystroke handlers to achieve this. To do this, we'll go to the project menu in our designer and select the client events pull down option. Then in the client event scripts popup, we'll select the keystroke option and here by pressing the plus icon at the bottom, we can add any number of keystroke handler combinations we want. We can specify various modifiers, such as shift, control or alt, whether you want your keystroke script to run when the key is pressed, when it's released or when a character is typed and various specific keys such as F1 or any others. Pressed and released are useful for any kind of character whereas typed is only useful for alphanumeric characters and that's going to happen after the key is typed.

[01:03] So it's similar to released, except it cannot be used with special keys such as the F keys. So let's set up a couple of simple actions to be taken. How about if we set up shift F8 pressed? And we'll click okay here to get back to the prior screen. And then it will display a popup GUI window. For example, I'll type the initial system.gui and then control space bar to get the auto-complete. And we'll scroll down here to the message box and in parentheses and double quotes, I'll add a message such as shift F8 pressed and then we'll close out the statement like so. And we'll hit apply down here at the bottom which applies the change but leaves this dialogue open.

[02:03] And then for one more, we'll click the plus once more, then let's say we type the letter P and click okay once more. And this time we'll display an existing pop up window, test popup. I'll open it here on the left in the project browser and we can see it's just a simple message window like so. Then I'll grab the path to this window by right clicking on it in the project browser on the left, selecting copy path and then we'll restore our keyboard scripts window from the task bar and then we'll use it in the statement as follows, system.nav and control space bar and that'll give me a list of our available methods. So I'll go to open window and again in parentheses and double quotes, this time I'll copy paste the window that we copied and we'll close it out again like so.

[03:13] So now that we've got two keystroke scripts set up, this time we'll click okay instead of apply to both apply the changes and dismiss the window, then we'll save our changes to the gateway. And then let's see both of these in action. To see these actions take place, we'll have to open up a vision client. And I conveniently happened to have one minimized in my toolbar, so I'll open it up like so. And when we type P, we see the specified window popup in the client and when we click shift F8, we see this popup GUI dialogue appear. So with simple client event scripts such as these, we can run whatever actions we want to and your Ignition Client will execute the specified script actions upon a particular keystroke combination.

You are editing this transcript.

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

close

Share this video