Ignition scripting

How can i key press an F12 to a BUTTON? Is there a way i can do it in ignition?

Under Project-Scripts-Client Event Scripts
Keystroke scripts. Add one for F12

how can i incorporate it to a button
for example a a button
the keystroke i want to incorporate with is F7
when i press that F7(SUBMIT BUTTON) I will the integer/weight in a numeric text field?

You can add a script to the button’s keyPressed or keyReleased event handlers that will push the button for you when you press F7. it would look something like:

if event.keyCode == event.VK_F7:

This will trigger the actionPerformed script for that button.

its not working
shall i put that code in scripting functions to a button?

i have tried it but i doesn’t refresh the data incorporated to F7
I have weighing that prints the weight as F7, and i want to incorporate the F7 to a button in ignition. I have tried the code you have given. As i press the button it sends the weight to a numeric field but only when i pressed the key F7.

Do you want tapping the button to create an F7 key press? If so, you could try something like this in the actionPerformed event on the button:

from java.awt import Robot
from java.awt.event import KeyEvent

robot = Robot()

yes, i want to make the button as may F7 key
i tried your code it doesnt work also
appreciate it much for helping
thank you all of you guys

im tryng to install pynput
it doesnt work also
do you have idea how to make pynput work?

I verified that @witman’s code does, in fact, work with two separate utilities I use.

An easy test of the code would be to change F7 to F1 and see if it launches the help webpage.

Maybe if you explained what you are trying to accomplish, we may be able to better help you. :slight_smile:

Yes, I misunderstood what you were attempting. The code I posted is just a keybinding for the button; sorry about that.

Sorry, ignore my previous part. :slight_smile:

If I’m reading this correctly, @rbabcock was on the right track, but what you need is a keystroke client event script. Keep in mind that you will need to monitor that the correct window is open.


  1. Do you want a button pressed in Ignition to create an F7 key press? If so, the code I posted does that… but there are some more details that affect whether this will work for what you’re trying to do:
    a) Where do you press F7 now that you’re trying to replace with a button in Ignition? On some other device, like a scale? Or on the computer keyboard running an Ignition HMI?
    b) Is it Ignition or some other program that normally has the focus when you press the F7 button?

  2. Or do you want pressing F7 to press a button in Ignition? If so, see @rbabcock’s and @JordanCClark’s posts above.

yes sir @witman, i want my button act as an F7 ,i want to replace the F7 to act in a button in my HMI,i am using a weighing scale device with a configuration of F7 to work or to capture its weight and show it the captured weight to a numeric field.

yep its okay, thanks for helping

Where do you press F7 now? On the scale? Or on a keyboard connected to the computer running the Ignition HMI?

right now on a keyboard, but i want is pressing a BUTTON that act as an F7 (keyboard)

If you’re pressing F7 on the computer keyboard and that is working, the code I posted above does create an F7 key press when you press a button with that code in the action performed script of the button like this.

If this does not work for your application, the next question is where is the focus when you press F7 on the keyboard and it works? Is the focus/cursor in a component in Ignition or in another program?


that code actually works as a keypress
but the problem is i have to press first the F7 in keyboard before it captures the actual weght.
Sorry im having a harding time for expalining hehe

is there a key event the refreshes after pressing the button?