sl4util

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.

Greg Shenaut

sl4util.zip (20.1 KB)

Good work!

Hi Greg,

I’m impressed! Want a job with Cedrus? :slight_smile:

If I may add two comments:

  • Standard disclaimer: this is not supported by Cedrus

  • Given the feedback that we received on the forums, we decided to bring forward the implementation date for importing stimulus list contents from external files. This was originally planned for version 5.0 (no ETA), but will instead be implemented as part of version 4.5 due out this year. Version 4.5 will be a free update to all SuperLab 4.x users.

Hisham.

Many thanks to Greg Shenaut !

Here is a ( MinGW ) Windows build of Greg’s utilities ( all credits belong to him, all mistypes are mine by default ), with some small insignificant changes made to the dump() routine ( the one I am most interested in at the moment ) .

One might also need the MSVCRT.DLL ( C runtime ) library from Microsoft .


For those who understand: one can easily build Greg’s code under Cygwin, and my only suggestion will be to change “isprint©” test to sth like “( isprint© || ’
’ == c )”, though the latter does not bring too much new information to the dump output .

In my MinGW build, I have detected weird behavior of the read() function, that was not able to load the whole file, even if called in a loop ( I’ve got 0 as a returned value after the second call, and the first one gave me like 119 bytes from my 3863-byte test file ) .
So I have used fread() instead .

PS. I will write another “betterment proposal” (basically – to open the .sl4 file format) when I will calm down a little bit; the reason I need to is that it looks like it is the third year users have to make guesses about the data file format, while there looks to be no way to edit them programmatically, and the only approach I have found on this forum is this nice utility by Greg Shenaut (officially unsupported by Cedrus but this was the only thing proposed here on the forums by the Cedrus team).
Anyway, it’s better to have anything than nothing.

sl4util.0.0.1.zip (23.8 KB)

msvcrt.zip (182 KB)