Automatically Logging In all Users as Operators in Your TestStand Operator Interface

Updated Nov 12, 2020

Designed to modify the login process of your operator interface only, this example does not affect the login behavior of the sequence editor. This example demonstrates one method of how to login all users of your operator interface with Operator privileges by creating a new User object based on the existing Operator profile. Then, the example uses the User object to login to the TestStand operator interface.

By default, the login and logout process is executed in the LoginLogout sequence in the <TestStand>\Components\NI\Callbacks\FrontEnd\FrontEndCallbacks.seq file. This document shows you how to modify your FrontEndCallbacks.seq file to achieve an automatic login process. Attached is a modified FrontEndCallback.seq file which describes the changes necessary.

When you use the operator interface, you may find it useful to automatically login users with certain privileges. One method of achieving this is to modify the <TestStand>\Components\Users\Callbacks\FrontEnd\FrontEndCallbacks.seq file. If you do not have this file in your Users directory, copy the file from the <TestStand>\Components\NI\CallBacks\FrontEnd\ directory to the Users directory. National Instruments recommends that you only modify sequence files that you have copied to the <TestStand>\Components\Users\ directory.

After opening <TestStand>\Components\Users\Callbacks\FrontEnd\FrontEndCallbacks.seq, you will see two default steps, Login and Logout, in the LoginLogout sequence. Add the precondition, RunState.IsEditor, to the Login step.

This precondition determines whether the LoginLogout sequence is executed within the operator interface or the sequence editor. This ensures that the Login step is executed in the sequence editor only. When you add a new precondition to the Login step, TestStand prompts you to select Insert AllOf or Insert AnyOf because the Login step contains an existing precondition. Insert AllOf or Insert AnyOf determines whether to logically AND or OR the existing precondition with the new precondition. Select Insert AllOf. Your final precondition should now resemble Figure 1.

Note The Logout step must be executed in the sequence editor and your operator interface. The Logout step is executed when you shut down the operator interface and sequence editor.

Figure 1. Procondition - LoginLogout Dialog Box

 

Creating a User Profile Step

Follow the steps below to create a UserProfile step.

  1. Return to the LoginLogout sequence and create two new local variables of type ActiveX reference.
  2. Name the variables UserProfile and newUser.
  3. Select the ActiveX Automation Adapter from the Adapter ring control.
  4. Insert an Action step after the existing Login step.
  5. Name this step UserProfile.

    Note The Login step is used to obtain a UserProfile object based on an existing user profile. The UserProfile object is needed to create a User object as explained in the Creating a New User Step section.
     
  6. Set the precondition for the UserProfile step to !RunState.IsEditor. This step only runs when called by your operator interface using this precondition.
  7. Select Specify Module from the context menu of the UserProfile step.
Configure the UserProfile step using the following control values:
 
Control NameValue
ActiveX referenceRunState.Engine
Automation serverTestStand API 2.0 (Ver 1.0)
Object classEngine (IEngine)
ActionCall Method
MethodGetUserProfile
Return ValueLocals.UserProfile
userProfileName"operator"
Figure 2 shows the completed Edit Automation Call dialog box.

 

 

Creating a New User Step

Follow the steps below to create the Create New User step.

  1. Insert an Action step, after the UserProfile step, that uses the ActiveX Automation Adapter.
  2. Name this step Create New User. This step calls the NewUser method of the Engine class.
  3. Add the precondition, !RunState.IsEditor, to this step.
  4. Select Specify Module from the context menu and configure the step using the following control values:
 
Control NameValue
ActiveX referenceRunState.Engine
Automation serverTestStand API 2.0 (Ver 1.0)
Object classEngine (IEngine)
ActionCall Method
MethodNewUser
Return ValueLocals.NewUser
userProfileLocals.UserProfile

Notice that this step uses the UserProfile object obtained from the preceding UserProfile step.

Creating a Login Operator Step

The final step peforms the login using the newly created User object. Follow the steps below to create the Login Operator step.

  1. Insert an Action step that uses the ActiveX Automation Adapter.
  2. Name the step Login Operator.
  3. Set the precondition to !RunState.IsEditor.
  4. Select Specify Module from the context menu and configure the step using the following control values:
     
    Control NameValue
    ActiveX referenceRunState.Engine
    Automation serverTestStand API 2.0 (Ver 1.0)
    Object classEngine (IEngine)
    ActionSetProperty
    MethodCurrentUser
    CurrentUserLocals.NewUser

 

Additional Modifications

Once you have created a User object using the Create New User step, you can use additional steps to modify properties of the User object before you login. For example, you could set the name of the User object to "Default User".

You may want to make use of one other additional modification. When set to True, the Parameters.isInitialLogin property in the LoginLogout sequence tells you if you are logging in for the first time. If you use this property as a precondition for certain steps, you can restrict the automatic login of your operator interface to the first login of the application. In this manner, a user with more priveleges could login by selecting File»Login after the application has launched.