Using StartupInfo Parameters
Any name/value pairs entered into the StartupInfo Editor will be loaded into the Context as attributes when the associated *.es3 or *.ebs3 file is run. Like other attributes in E-Prime, they can be accessed using the c.GetAttrib command in an InLine, or by placing the attribute name between brackets (e.g., [Subject]) in an object's Property Pages.
Note that using a property name that is native to E-Prime (e.g., Subject, Mouse.ShowCursor, Display. UseDesktopSettings) will allow you to edit experiments without having to actually open them in E-Studio. A common example would be if you were using the PST Serial Response Box in your lab. The SRBox device may need to be set to use COM port 1 for the majority of the machines; however, some machines may require the SRBox device to be set to use COM port 2. Instead of manually editing the *.es3 file on the machines that use COM port 2, you could simply add the SRBox.CommPort property to the global StartupInfo file on these machines, and set the value of this property to 2. Any experiment that uses the SRBox on this machine will automatically use the correct port.
Changing StartupInfo Parameters
All StartupInfo files are XML-based, allowing them to be modified externally through another application (e.g., Notepad, Javascript, etc). E-Prime 3.0 has also expanded the E-Basic language to allow StartupInfo files to be modified using InLine script. This is particularly useful when you want to store information about one run so that it can be used during another or want to change a parameter after each run.
A common scenario for the use of StartupInfo parameters would be to increment a subject number automatically after each run, allowing the Subject number StartupInfo prompt to be skipped at the beginning of the experiment. The correct subject number would be used automatically; removing the need to keep track of or memorize which subject number should be used each time the experiment is run. If the DataFile.Filename.Override property is being used to specify a custom location and name for the *.edat3 file produced by the experiment, the incremented subject number could be used to ensure that the custom file name also changes (i.e., to avoid overwriting data). For example, the following script could be placed in an InLine to increment the Subject number in the StartupInfo file:
'Increment and set the subject number which will get loaded next time
Rte.StartupInfo.Local.SetProperty "Subject", CLng(c.GetAttrib("Subject")) + 1
Dim strName As String
strName = "C:\\MyExperiment-" & Rte.StartupInfo.Local.GetProperty("Subject") & "-1" Rte.StartupInfo.Local.SetProperty "DataFile.Filename.Override", strName
Generally, this script could be placed in an InLine at any point in the experiment. However, in many cases the Subject number should only be incremented if a certain amount of data has been collected (e.g., if an experiment is safely aborted early on and will be immediately presented to the same subject again, the same Subject number may be used).
Additional InLine script could be added to the experiment to indicate when the Subject parameter
should be incremented. For example, if a specific number of trials are presented from the TrialList, then a Boolean variable is set to True:
If c.GetAttrib(“TrialList”) > 50 Then boolIncrement = True
End If
At the end of the experiment, another InLine could be used to check the value of this Boolean and increment the Subject number if necessary:
If boolIncrement = True Then
'Increment and set the subject number which will get loaded next time
Rte.StartupInfo.Local.SetProperty "Subject", CLng(c.GetAttrib("Subject")) + 1
Dim strName As String
strName = "C:/MyExperiment-" & Rte.StartupInfo.Local.GetProperty("Subject") & "-1"
Rte.StartupInfo.Local.SetProperty "DataFile.Filename.Override", strName
End If
Previous Article: STARTUPINFO EDITOR: Naming and Editing Property Values (StartupInfo Editor) [22735]
Comments
0 comments
Please sign in to leave a comment.