This article applies to:
E-Prime 3.0
E-Prime 2.0
E-Prime 1.x
Detail
It is possible to gain access to an E-Object using InLine script. This means that you can assign a specific E-Object to a variable in script, and then use the variable to alter the properties of the referenced objects. For example, say you are implementing a study-recall experiment where you will need to access and modify several List objects. Instead of creating a separate InLine object for each List object you want to modify, you can access the appropriate List object as follows. Note that these examples apply to ANY E-Object. The examples use List objects, but you can simply replace the variable declaration with the type of object you want to access (e.g., As TextDisplay instead of As List) along with the conversion function (e.g., CTextDisplay instead of CList).
Option 1: Specify the Object Name Directly
This is the most obvious situation, where you know which object you want to modify. Using the above example, to gain access to a List object named "TrialList":
Dim ListName As List
Set ListName = CList(Rte.GetObject("TrialList"))
ListName.SetAttrib 1, "Stimulus", "Test"
In this example, the Stimulus attribute in the first level of the TrialList object would be set to "Test".
Option 2: Reference an Attribute
If you will be modifying a specific object depending on the trial, you can put the object name in an attribute and then reference the appropriate object in script by gaining access to the object specified in the attribute:
Dim ListName As List
Set ListName = CList(Rte.GetObject(c.GetAttrib("ObjectName")))
ListName.SetAttrib 1, "Stimulus", "Test"
In this example, the Stimulus attribute in the first level of the List object specified by the ObjectName attribute would be set to "Test"
Option 3: Concatenate the Object Name
This is one of the more useful options, where you can gain access to a particular object using a string concatenation. This allows you to use loops to make changes to many objects at the same time. This works best when you have several objects with the same name except for a number at the end. For example:
Dim ListName As List
Dim nCount As Integer
For nCount = 1 To 5
Set ListName = CList(Rte.GetObject("TrialList" & nCount))
ListName.Reset
Next
In this exampe, the TrialList1-5 objects will be reset.
For more information view the E-Prime Command Reference for specifics involving E-Basic (https://pstnet.com/ecr).
Comments
0 comments
Please sign in to leave a comment.