1. Introduction
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.
2. Modifying Login Step Preconditions
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
3. Creating a User Profile Step
Follow the steps below to create a UserProfile step.
- Return to the
LoginLogoutsequence and create two new local variables of type ActiveX reference. - Name the variables
UserProfileandnewUser. - Select the ActiveX Automation Adapter from the Adapter ring control.
- Insert an Action step after the existing Login step.
- Name this step
UserProfile.
Note TheLoginstep 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.
- Set the precondition for the UserProfile step to
!RunState.IsEditor. This step only runs when called by your operator interface using this precondition. - Select Specify Module from the context menu of the UserProfile step.
- Configure the UserProfile step using the following control values:
Control Name Value ActiveX reference RunState.EngineAutomation server TestStand API 2.0 (Ver 1.0)Object class Engine (IEngine)Action Call MethodMethod GetUserProfileReturn Value Locals.UserProfileuserProfileName "operator"
Figure 2 shows the completed Edit Automation Call dialog box.
Figure 2. Edit Automation Call Dialog Box
4. Creating a New User Step
Follow the steps below to create the Create New User step.
- Insert an Action step, after the UserProfile step, that uses the ActiveX Automation Adapter.
- Name this step
Create New User. This step calls the NewUser method of the Engine class. - Add the precondition,
!RunState.IsEditor, to this step. - Select Specify Module from the context menu and configure the step using the following control values:
Control Name Value ActiveX reference RunState.EngineAutomation server TestStand API 2.0 (Ver 1.0)Object class Engine (IEngine)Action Call MethodMethod NewUserReturn Value Locals.NewUseruserProfile Locals.UserProfile
Notice that this step uses the UserProfile object obtained from the preceding UserProfile step.
5. 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.
- Insert an Action step that uses the ActiveX Automation Adapter.
- Name the step
Login Operator. - Set the precondition to
!RunState.IsEditor. - Select Specify Module from the context menu and configure the step using the following control values:
Control Name Value ActiveX reference RunState.EngineAutomation server TestStand API 2.0 (Ver 1.0)Object class Engine (IEngine)Action SetPropertyMethod CurrentUserCurrentUser Locals.NewUser
6. 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.
