Automatically Logging In all Users as Operators in Your TestStand Operator Interface
Overview
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.
Table of Contents
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.
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.
[+] Enlarge Image
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.

[+] Enlarge Image
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.
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
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. Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
