16
3. Playing a stimulus 4. Waiting for an event 2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress WaitForTabZoneA t OpenRec CloseRec 1. Simple RecStandard RecNewPics Basic script commands (1) 10-12 April 2012, Mshs, University of Poitiers, France Hands on scripts…

3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Embed Size (px)

Citation preview

Page 1: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

3. Playing a stimulus

4. Waiting for an event2. Start / stop recording

DisplayPic / HidePicturePlaySound / StopSoundDisplayMsg / HideMessage

WaitForKeyPressWaitForTabZoneAt

OpenRecCloseRec

1. SimpleRecStandardRecNewPics

Basic script commands (1)

10-12 April 2012, Mshs, University of Poitiers, France

Hands on scripts…

Page 2: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

1. Simple

1.1. RecStandard(AddToParticipantName)

Launches the Simple acquisition from script. Data will be recorded into files named from the participant’s Id. Replace optional parameters AddToParticipantName with something you want to add to the participant’s Id to name data files.

This is the only script command family that “internally” manages start and stop of recording.

The script command RecStandard(_trial) will record data into a file named “testwin7_trial”.

10-12 April 2012, Mshs, University of Poitiers, France

Page 3: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

1.2. RecNewPics(AddToParticipantName, BackPic, Pic1, Pic2)

Launches the Simple acquisition, specifying the background picture, pictures associated with the first and second trigger zones.

Command example: RecNewPics(_P2,YellowBack.bmp,Capsela.bmp,car.bmp)

The editor Command | Simple acquisition | RecNewPics menu opens this dialog box:

The dialog box retrieves the Simple configuration panel options

Insert resulting command in the script editor

Optional (no value required)

10-12 April 2012, Mshs, University of Poitiers, France

Page 4: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Example of use:

Launching the Simple recording many times (same task), only changing pictures used.

Script example:

RecNewPics(_Trial1,BackGnd.bmp,Stimulus1.bmp,nothing.bmp)RecNewPics(_Trial2,BackGnd.bmp,Stimulus2.bmp,nothing.bmp)RecNewPics(_Trial3,BackGnd.bmp,Stimulus3.bmp,nothing.bmp)

In this example, only picture associated with trigger zone 1 is changed. Background picture and picture associated with trigger zone 2 is always the same.

10-12 April 2012, Mshs, University of Poitiers, France

Script example:

RecNewPics(_Trial1,BackGnd.bmp,Stimulus1.bmp,nothing.bmp)RecNewPics(_Trial2,BackGnd.bmp,Stimulus2.bmp,nothing.bmp)RecNewPics(_Trial3,BackGnd.bmp,Stimulus3.bmp,nothing.bmp)

For each participant, 3 recordings will be performed (3 data files): <ParticipantName>_Trial1<ParticipantName>_Trial2<ParticipantName>_Trial3

Script example:

RecNewPics(_Trial1,BackGnd.bmp,Stimulus1.bmp,nothing.bmp)RecNewPics(_Trial2,BackGnd.bmp,Stimulus2.bmp,nothing.bmp)RecNewPics(_Trial3,BackGnd.bmp,Stimulus3.bmp,nothing.bmp)

Page 5: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Trying to open an acquisition while another is already in progress will close the first one before opening the second.

Any command “pausing” script execution will not pause recording: recording is performed in parallel with script execution.

2. Start / stop recording These commands can be issued multiple times to perform several successive data acquisition.

2.1. OpenRec(AddToParticipantName)

Launches the acquisition: starts tablet (and optionally eye tracker) data recording.

The recording will go on until a command explicitly stop it or script is over.

Data will be recorded into files named from the participant’s Id. Replace optional parameters AddToParticipantName with something you want to add to the participant’s Id to name data files.

10-12 April 2012, Mshs, University of Poitiers, France

Page 6: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

2.2. CloseRec

Stops the acquisition and closes data file.

The script command OpenRec(_trial) will record data into files named “testwin7_trial”.

Example:

10-12 April 2012, Mshs, University of Poitiers, France

Page 7: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

(Pre-writing pause)

Script “OpenRec” command

“CloseRec” command…

Acquisition starts

Tablet is activated

Eye-tracker is activated

Recording starts

… Recording stops

Script ends

Acquisition stops

Tablet is deactivated

Eye-tracker is deactivated

Session log file is opened

Log file is closed

(do something)……

OPenRec / CloseRec and the acquisition sequence…

10-12 April 2012, Mshs, University of Poitiers, France

Page 8: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

• The recording timer starts immediately when the command OpenRec is activated or when the “Simple” acquisition (RecStandard, etc.) is executed.

Time

Data files

(Acquisition starts)“Go”

“OpenRec”

0

“OpenRec”

0

“CloseRec”

7814

“CloseRec”

4898

OPenRec/CloseRec and timing …

10-12 April 2012, Mshs, University of Poitiers, France

• Each new data file (i.e. recording) starts at hour zero.

Page 9: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

3. Playing a stimulus

3.1. DisplayPic(PictureFileName,Duration,X,Y)

Displays the picture PictureFileName on screen at location X,Y for Duration milliseconds.

Example: DisplayPic(MyPicture.bmp,5000,0,0) Translation: the picture MyPicture.bmp is displayed on screen in the upper left hand corner of the screen (coordinates 0,0) for 5 seconds.

Magic values

Script accepts the magic value ”-1” as a parameter value for: Duration : “-1” means “forever” Screen coordinates: “-1” means “auto-center in screen”

Magic values

Script accepts the magic value ”-1” as a parameter value for: Duration : “-1” means “forever” Screen coordinates: “-1” means “auto-center in screen”

3.2. HidePicture

Removes pictures previously displayed with DisplayPic. Screen background is restored.

Example: DisplayPic(MyPicture.bmp,-1,-1,-1) Translation: the picture MyPicture.bmp is displayed centered on screen. Script execution will go on, leaving the picture on screen.

10-12 April 2012, Mshs, University of Poitiers, France

Page 10: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

3.3. PlaySound(WaveFileName,Wait)

Plays the sound file WaveFileName.

3.4. StopSound

Stops the sound file currently played.

10-12 April 2012, Mshs, University of Poitiers, France

Example: PlaySound(dictation.wav,FALSE) Translation: the sound file Dictation.wav is played and script execution will immediately continue.

Example of use: a (previously recorded) dictation is played, while tablet data is being recorded.

If the parameter Wait is replaced with “TRUE”, the script interpretor will wait until the sound is finished. Otherwise (“FALSE”), it will resume script execution.

Page 11: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

3.5. DisplayMsg(Message,Duration,X,Y,Transparent)

Displays the text Message on screen at location X,Y for Duration milliseconds.

3.6. HideMessage

Removes the message previously displayed on screen.

Peculiarities: The message is a single line of text. Only one message can be displayed at a time.

10-12 April 2012, Mshs, University of Poitiers, France

Example: DisplayMsg(Welcome to my lab !,4000,-1-1,FALSE) Translation: the message “Welcome to my lab !” will be displayed centered on screen for 4 seconds.

If the parameter Transparent is replaced with “FALSE”, the message will be displayed on a stripe colored with the font background color, otherwise (“FALSE”), only the characters will be displayed on screen.

Page 12: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

These commands do not pause an acquisition / recording but only the script interpretor.

Some commands tells the script interpretor to stop reading script (pause) until a certain event happens. These commands are mainly grouped into the “Wait” category.

4. Waiting for an event (participant action)

4.1. WaitForkeypress

Stops script execution until a key of the keyboard is pressed.

4.2. WaitForTabZoneAt(x1,y1,x2,y2,CanDraw,MustLeave)

Stops script execution until the pentip is pressed into the area located at tablet coordinates X1,y1,x2,y2. If the parameter CanDraw is set to “TRUE”, the participant's writing is displayed on screen. If the parameter CanDraw is set to “TRUE”, the pentip must be removed from the area before the script execution can resume.

Figure: Command | Wait | WaitForTabZoneAt dialog box10-12 April 2012, Mshs, University of Poitiers, France

Page 13: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Exercise 1

Write a script such that a dictation takes place.

An instruction is given to participant. (S)He’ll press a key when ready to write. The dictation (pre-recorded sound file “dictation.wav”) will start and tablet data will be recorded. Handwriting will be displayed on screen.

DisplayMsg(This is a dictation exercise.,4000,-1,-1,TRUE)

10-12 April 2012, Mshs, University of Poitiers, France

DisplayMsg(Press a key when ready to begin…,-1,-1,-1,TRUE)

WaitForKeyPress

OpenRec(_dictation)

PlaySound(Dictation.wav,FALSE)

HideMessage

WaitForTabZoneAt(35596,21022,44697,27932,TRUE,FALSE)

CloseRec

Explain exercise

Get ready…

Wait until a keyboard key is pressed

Start tablet recording, play sound and continue script execution

Remove message from screen

Script execution is suspended until the pen is pressed into the area mentioned. During this time, writing is displayed on screen.

Stop tablet recording

Hands on scripts

Page 14: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

DisplayMsg(A picture will be displayed for 5 seconds.,4000,-1,-1,TRUE)

DisplayMsg(As soon as this picture will disappear\, you will write down a description.,5000,-1,-1,TRUE)

DisplayMsg(When you’re finished\, press the pentip in the area labeled “End”,4000,-1,-1,TRUE)

DisplayMsg(Press a key when ready to begin…,-1,-1,-1,TRUE)

WaitForKeypress

HideMessage

OpenRec(_island)

DisplayPic(ile.bmp,5000,0,0)

WaitForTabZoneAt(35596,21022,44697,27932,TRUE,FALSE)

CloseRec

Exercise 2

Write a script such that a picture is displayed for 5 seconds, then the participant writes a description of the picture. An instruction should be given to the participant to explain what (s)he has to do.We don’t want handwriting to be displayed on screen. Tablet data will be recorded for the duration of description writing.

10-12 April 2012, Mshs, University of Poitiers, France

Page 15: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Other commands of the Wait category (not presented here) are convenient mixtures of basic commands.

For example, WaitForKeyPressPic is a combination of WaitForKeypress and DisplayPic.

10-12 April 2012, Mshs, University of Poitiers, France

Page 16: 3. Playing a stimulus 4. Waiting for an event2. Start / stop recording DisplayPic / HidePicture PlaySound / StopSound DisplayMsg / HideMessage WaitForKeyPress

Simple is better: complex script is prone to errors and participant may misunderstand the task.

Dirty-and-effective: sometimes, a good old cut-and-paste of blocs of script is more effective and secure than spending hours building complex loops.

Do not wait until whole script is written to test it. Probing for errors will be easier.

Carefully check what data will be recorded. For example, should time spend to watch a picture be included in pre-writing pause or not (it may also depend whether eye movements are recorded or not). This will determine where OpenRec command will be inserted in script.

Displaying writing on screen is not always desirable. This is resources and time consuming for the computer and it may perturb participant.

10-12 April 2012, Mshs, University of Poitiers, France

A few advices