# Simulate an Enter Key Press

**URL:** <https://forum.inductiveautomation.com/t/simulate-an-enter-key-press/59756>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [May 18, 2022, 10:44pm UTC](https://forum.inductiveautomation.com/t/simulate-an-enter-key-press/59756 "2022-05-18T22:44:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwalters1](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@rwalters1](https://forum.inductiveautomation.com/u/rwalters1)\
**Post date:** [May 18, 2022, 10:44pm UTC](https://forum.inductiveautomation.com/t/simulate-an-enter-key-press/59756/1 "2022-05-18T22:44:39Z")

</div>

Ignition Vision:  
I have a popup screen with a button that closes the popup window and sets the focus on a text field in the main window- This functions as expected- Once the focus is set, I would also like to have a simulated ‘Enter Key Press’ to invoke the keyPress event handler script to fire-

Is it possible to simulate an ‘enter’ key press within a script?-

Robert-

---

<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:** [May 18, 2022, 10:47pm UTC](https://forum.inductiveautomation.com/t/simulate-an-enter-key-press/59756/2 "2022-05-18T22:47:55Z")

</div>

It may be possible, but this a common and flawed line of thinking.

Don’t simulate a key press. Move your key press logic to a function in a script library, and make the key press event and whatever triggers this new scenario call that function.

---

<div class="post-metadata">

**Author:** ![rwalters1](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@rwalters1](https://forum.inductiveautomation.com/u/rwalters1)\
**Post date:** [May 19, 2022, 4:05pm UTC](https://forum.inductiveautomation.com/t/simulate-an-enter-key-press/59756/3 "2022-05-19T16:05:11Z")

</div>

Thank you, that worked beautifully!- Much appreciated-
