The session in which the current script/macro was invoked. Run-time only.
Newlook Smartclient only.
Introduced in Version 11.1.
ThisSession = [session object]
This property returns a reference to the current session. It is particularly useful if you need to execute different actions depending on which session a script or macro is running in.
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.
This example checks if the currently executing session has the name 'Helper':
if (ThisSession.Name == Sessions.Helper.Name);
{
// Execute some logic relevant to the 'Helper' session.
}
© 2004-2021 looksoftware. All rights reserved.