Hi,
I would like to navigate to another screen, whenever the user is inactive for more than 2 mins.I have explored using lastactivity sessionproperty (Current time - last active time) but unable to achieve the desired output as the script not triggered at all time.
Is there any option to achieve this?
Thanks in advance.
For the same problem I used a Change Script in a Label in a Dock, the label has a binding to display the Current time and works as a Status Bar Timer,
The change script of that Label should always trigger, did you try that? try implementing the logic in the Change Script.
This setup will navigate all ages of a session to a specified page (timeout_page
) after the user has been "inactive" for 120 seconds. Note that "inactive" means they have not clicked within the session; it has nothing to do with mouse movement, and so a user might actively be moving their mouse around the page and it will not register as activity.
- Place a custom session property.
- Bind this new custom session with an Expression binding:
((now(1000)-{session.props.lastActivity})/1000)>120
- Place a change script on this new property:
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
timeout_page = "/page/config/url/to/page/with/leading/slash"
if currentValue and currentValue.value: # 120 seconds has elapsed
for session in system.perspective.getSessionInfo():
if session.id == self.session.props.id:
for pageId in session.pageIds:
system.perspective.navigate(page=timeout_page, sessionId=session.id, pageId=pageId)
The pageId
part is important as the session property won't have a page thread to act on; specifying a pageId directs it to act on the page itself.
4 Likes