SetActiveSession Method

Change the value of Sessions.ActiveSession.

Client support

   Newlook Smartclient only.

Version Support

Introduced in Version 11.1 for Smartclient.

Syntax

Sessions.SetActiveSession(name)

Arguments

name - (String, Required)

Name of the session that will become the active session. A runtime error will be generated if a session name is specified that does not exist.

Use

This method is useful if you wish to change the session that is currently visible in the client.

Sessions.ActiveSession returns the currently visible session. It should not be confused with ThisSession, which returns the currently executing session (the one in which the current script/macro/expression was invoked). This is important to note, because while these two properties will often return the same session, there will be times when they are different. One of those times is immediately after you have changed the active session in a script. Calling Sessions.SetActiveSession does not change the value of 'App' or 'ThisSession' (within the context of any script or macro). If you wish to change the active session and then execute logic in that session, you will need to invoke the logic from an event that is triggered in the active session. The other scenario where these properties would return different sessions is one where you are executing logic from a session that is running in the background. In other words 'Sessions.ThisSession' is not the currently visible session.

Examples

J SCRIPT

// Create a new 'HelperSession' session and set it as the active session.

var newSession = Sessions.Add("HelperSession", {"StartupType": "Logic", "Startup": "HelperStartup", "Variables": {"HelperRunning": "True"}});

Sessions.SetActiveSession("HelperSession");

 

See Also

Sessions Collection | Working with sessions | Session Object | ActiveSession Property | StartupSession Property | Add Method - Sessions | Remove Method - Sessions

Applies To

Sessions Collection


© 2004-2021 looksoftware. All rights reserved.