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.
- Return to the LoginLogout sequence and create two new local variables of type ActiveX reference.
- Name the variables UserProfile and newUser.
- Select the ActiveX Automation Adapter from the Adapter ring control.
- Insert an Action step after the existing Login step.
- 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.
- 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.Engine |
Automation server | TestStand API 2.0 (Ver 1.0) |
Object class | Engine (IEngine) |
Action | Call Method |
Method | GetUserProfile |
Return Value | Locals.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.
- 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.Engine |
Automation server | TestStand API 2.0 (Ver 1.0) |
Object class | Engine (IEngine) |
Action | Call Method |
Method | NewUser |
Return Value | Locals.NewUser |
userProfile | 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.Engine |
Automation server | TestStand API 2.0 (Ver 1.0) |
Object class | Engine (IEngine) |
Action | SetProperty |
Method | CurrentUser |
CurrentUser | 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.