# Anyway to make key bindings in perspective?

**URL:** <https://forum.inductiveautomation.com/t/anyway-to-make-key-bindings-in-perspective/67759>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 18, 2022, 12:25am UTC](https://forum.inductiveautomation.com/t/anyway-to-make-key-bindings-in-perspective/67759 "2022-12-18T00:25:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![IgnitionNewbie](https://avatars.discourse-cdn.com/v4/letter/i/94ad74/32.png) [@IgnitionNewbie](https://forum.inductiveautomation.com/u/IgnitionNewbie)\
**Post date:** [December 18, 2022, 12:25am UTC](https://forum.inductiveautomation.com/t/anyway-to-make-key-bindings-in-perspective/67759/1 "2022-12-18T00:25:08Z")

</div>

I was trying to see if I could make a button be clicked when pressing S on a keyboard in perspective

I saw a method for vision to do it on the forums but does perspective have one?

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [December 18, 2022, 1:16am UTC](https://forum.inductiveautomation.com/t/anyway-to-make-key-bindings-in-perspective/67759/2 "2022-12-18T01:16:32Z")

</div>

> [@New Feature: Perspective Key Events](https://forum.inductiveautomation.com/t/new-feature-perspective-key-events/49974):
>
> Similar in functionality to Vision’s Keystroke Scripts, we have introduced Key Events into Perspective’s Session Events, which can be found in the latest nightly build. These events can be found under the Project \> Session Events menu item: This functionality wraps a [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent) that is generated by the browser and provides the ability to match either a single key (with or without modifiers), or a regex pattern (series of keys) and execute a script once the match has been detected.…

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [December 19, 2022, 3:48pm UTC](https://forum.inductiveautomation.com/t/anyway-to-make-key-bindings-in-perspective/67759/3 "2022-12-19T15:48:36Z")

</div>

Note: don't have your key press handler try to invoke the button (besides this not being possible in Perspective, it's a bad pattern).

Instead, move business logic to a custom method on a component or, even better, a project library script. Accept only the pure parameters you care about, and return a simple value. Then your key press and your button can invoke the same script as needed.
