EthoVision XT 18 - THC - Trial and Hardware Control - Program Trial Control (Continued)
Last updated: Jul 30, 2026
Program Trial Control
Example 3 - Play a Sound at Trial 3
This example assumes that the researcher acquires a batch of trials live, and wants to present an acoustic stimulus during trial 3.
The batch file looks like as follows:
@echo off
echo %1
IF %1=="Trial 3" (
start wmplayer D:\Temp\Stimulus_sound.wav
)
timeout /t 5 /nobreak > NUL
Next, in the Trial Control settings, create an External command, specify the batch file and in the Command line options enter "%tn%".
Note:
- The line
echo %1reads the first parameter; in this case, the trial name. - In the IF line, there must be five spaces between Trial and the number 3. Reduce by one space if the trial number has more digits: 4 spaces for Trial 10–99, three spaces for Trial 100–999, etc.
- To make sure that you enter the correct number of spaces in the Trial name, copy the name of the trial from the Trial list (Setup menu > Trial List, then click Show/Hide > Variables and choose Trial Name). Copy the content of the cell in the Trial name column for that trial, and paste the trial name in the batch file.
Operators
Aim
The Operators help you combine actions, conditions and sub-rules in various ways.
Examples
- When at least one of the two conditions A and B is met, then do … . This is an example of conditions combined by an operator of the Any type (OR logic).
- When two conditions are met at the same time, then do … . This is an example of conditions combined by an operator of the All type (AND logic).
- When at least/at most/exactly 4 of 8 conditions are met, then do … . This is an example of conditions combined by an operator of the N of All type.
Procedure
- Define the conditions, actions, and rules that you want to combine. Place them in your Trial Control sequence as parallel branches, as shown in the figure below.
- In the Components pane, under Structures, double-click Operator or click the button next to it.
- If the Add an Operator window appears, it means that there is at least one operator of the same type in your experiment. You are asked to choose between creating a new operator, or re-using an existing one. If this window does not appear, skip this step.
- Create a new operator: A new operator is created.
- Re-use an existing operator: Select the name of the operator already present in your experiment.
- Under Name, enter the Operator name or accept the default name Operator (n), where n is a progressive number.
- Under Operator Triggers When, select the option that applies:
- Any (at least one) of the inputs is 'true'.
- All inputs are simultaneously 'true'.
- N of All inputs are simultaneously 'true'.
Where 'true' means a condition met, an action carried out, or a sub-rule finished (depending on the elements you want to combine).
If you choose the third option, specify how many inputs must be 'true':
=(exactly equal to),not=(not equal to),>=(at least),<=(a maximum of), etc. Specify the number in the box. - Enter a Comment (optional) to describe this operator, and click OK.
- A new Operator box appears in the Trial Control. Place the box to the right of the elements defined in step 1, and connect each element to the operator box.
- Connect the operator to the next element in the Trial Control sequence.
Notes
- Names of operators must be unique in your experiment. You cannot define two operators with the same Operator name, even if these are defined in two different Trial Control Settings.
- An Operator can also have just one input box. In that case the operator is of no use, because control passes immediately to the next box as soon as the input condition becomes true or the input action is carried out. EthoVision informs you about this.
- Operators can also combine sequences of elements. For example:
- Sequence 1: When the animal presses a lever (Condition), then drop a food item (Action).
- Sequence 2: Time = 5 minutes (Condition; this equals to waiting 5 minutes).
If you want the program to take an action when either sequence has been completed, combine the two sequences with an Any operator.
Re-Use Trial Control Elements
The elements of Trial Control (conditions, actions, operators, sub-rules and sub-rule references) that you have defined in other Trial Control Settings can be duplicated and re-used in the current Trial Control Settings to reduce your time spent editing.
To re-use all the elements defined in your current Trial Control Settings profile, make a copy of it: right-click the profile in the Experiment Explorer and select Duplicate.
To Re-Use a Trial Control Element
Notes
- If you choose the option Apply the new settings in all writable Trial Control profiles, changes are not made in those profiles made read-only after data acquisition.
Source: EthoVision XT 18 - THC - Trial and Hardware Control, Noldus Information Technology