User`s guide
E-Prime User’s Guide
Chapter 4: Using E-Basic
Page 127
not recommended, since it defeats the purpose of the graphical interface. In addition, E-Studio
always overwrites the EBS file each time it generates, which would discard any edits made
directly in the EBS file. However, reading through the EBS file is a good way to become familiar
with E-Basic and its components.
The second and third methods of using E-Basic are contained within E-Studio. E-Basic script can
be entered in objects that are placed on procedural timelines within the experiment, or E-Basic
script may be entered using the User tab in the Script window. The E-Object used for inserting
bits of E-Basic into the experiment is the InLine object. User-written script is generally placed in
one of three places in an experiment:
1. In an InLine object to be executed at a given time during a Procedure: This is the most
common placement of script. The script included in an InLine object is inserted "as-is"
into the EBS file. The location is determined by the placement of the InLine object in the
structure of the experiment.
2. On the User tab in the Script window to declare global variables: Refer to section 4.3.4-
Variable Declaration and Initialization.
3. In an InLine placed at the beginning of the experiment to initialize variables: For
example, global variables declared on the User tab must be initialized prior to their use,
and it is common to do so at the beginning of the experiment.
For details about the InLine object as well as the User tab in the Script window, refer to sections
4.3.4-Variable Declaration and Initialization and 4.4-Basic Steps for Writing E-Prime Script, as
well as Chapter 2-Using E-Studio.
4.2.1 Syntax
The E-Basic language is object-oriented. Each object has a list of associated properties and
methods. An object appears in code using object.property or object.method where "object"
equates to the object's name, and the item after the dot (.) refers to either the object's particular
property or method.
4.2.1.1 Objects
Objects are essentially the core components of E-Basic. An object in E-Basic is an encapsulation
of data and routines into a single unit. The use of objects in E-Basic has the effect of grouping
together a set of functions and data items that apply only to a specific object type.
In E-Studio, there are a variety of E-Objects including TextDisplay, Slide, List and so on. The
graphical representations of those objects are accessible in E-Basic using the object.property
syntax. In the example below, Instructions is a TextDisplay object. The statement follows the
object.property syntax to set the Text property for the Instructions object.
Instructions.Text = "Welcome to the experiment"
Object.Properties
Objects expose data items, called properties, for programmability. Usually, properties can be
both retrieved (Get) and modified (Set). Just as each E-Object in E-Studio has a set of
associated properties, so do objects in script. The property of the object is referenced using the
object.property syntax.