I needed to be able to make a fairly large number of variants of a SuperLab experiment (400), and was reluctant to try to do them all by hand, The most time-consuming and error-prone part was reading in the stimulus lists: each variant has three parallel lists of text stimuli to be loaded. Anyway, it struck me that it might be possible to figure out enough about the structure of the sl4 scenario file to replace an existing stimulus list with a new one. After some fiddling around over the long weekend, I came up with the attached C program, which I call sl4util. It hasically has three capabilities: it can make a somewhat readable ASCII dump of an sl4 file; it can extract the contents of a specified stimulus list to standard output; and it can replace one or more specified stimulus lists with new ones and write the resulting sl4 file to standard output. For example, you can extract one or more stimulus lists, randomize or otherwise manipulate them, and then put them back, or, you can create a large set of counterbalanced, randomized stimulus lists and use a script to insert them into copies of prototype sl4 file. I used it to set up my 400 sl4 variants with a script and I plan to keep on using it in future experiments.
Sl4util is really nothing more than a very limited kludge. It may contain errors, and if the format of the sl4 file ever changes, it will stop working. Furthermore, I have only used it on Macs, although there isn’t any reason why it shouldn’t work on PCs, given that the sl4 format is the same on both. So, for what it’s worth, and in the hope that someone else may find it useful or may be inspired to build on it for some other purpose, I have attached the C source and a Mac executable (universal binary) below. I put it into zip format, which I never use: I hope it is readable.
sl4util.zip (20.1 KB)