E-Prime: overriding COM port at runtime

If your E-Prime script uses the COM port, (typically if you’re using an SRBox) , then you will know that you have to code the port ID into the script. If you run your experiment on a different PC, the COM port ID may be different.

If you’re not able/don’t want to edit the source file, you can override it at runtime with a local config file.

  1. Create a textfile in the same folder as you E-Prime exp.
    • insert the following text:-

    • <?xml version="1.0" encoding="utf-8" standalone="yes"?>
      <StartupInfo>
          <StartupInfoItem itemName="SRBOX.CommPort">1</StartupInfoItem>
      </StartupInfo>

save the file and then rename it to my_exp_name.startupInfo  {replace my_exp_name with the identical name of your es2 file (without the .es2)}

When you run your experiment, E-Run looks for a ‘.startupInfo’ file with the same name as your experiment and uses its setting to override the current ones.

NB: If you have E-Prime installed on you PC, then double-clicking on the ‘.startupInfo’ file will automatically run the startupInfo editor program and this gives you a simpler way to edit the file= but if you don’t have this then just run notepad and open the startupInfo file in it and change the ‘1’ to whatever port number you want.

See the docs for other settings that can be changed in this manner.

Leave a Reply