Session KeyEvents in Designer not firing

Potentially I am missing something here, but I can’t seem to get any of the session key events firing in the designer.

I noticed this when I was trying to send a message to a page, with the following script:

system.perspective.print("arrowRight", sessionId=page.session.props.id, pageId=page.id)
system.perspective.sendMessage("arrowRight", {}, scope="session", sessionId=page.session.props.id)

When I realized, that I can’t seem to get the id from the session, so I tried just printing something in the logs so I could take a deeper look at the available attrs on the page.session object with on the keyDown for the . key:

system.util.getLogger("Session").info("Hello")

Nothing ever shows up in the logs. Any ideas what I am missing? I am wondering if even in preview mode the designer is swallowing up any key press events and not allowing them to make their way to the embedded browser.

Key Events aren’t expected to work in the designer.
https://docs.inductiveautomation.com/display/DOC81/Perspective+Session+Event+Scripts#PerspectiveSessionEventScripts-KeyEvents

1 Like

Note taken! I did not see that line.

Would likely be nice if there was a small snippet about that in the description here, to avoid any confusion for other developers in the future.

Even just taking the

Scripts that execute in the Session on a specific keystroke.

and extending it to

Scripts that execute in the Session on a specific keystroke. Key event detection is only active inside of a Perspective session and is not active inside of the Designer.

Would be nice!

1 Like