Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Set duration in form

edited April 2013 in OpenSesame


I would like to know if there is a possibillty to set duration using a form.
In this form I'm presenting an image with an open question. I would like to give my participants limited time to answer the question. I hope someone knows how to do this!


  • edited 2:28PM

    I'm afraid that forms do not currently support a timeout value. However, you may want to take a look at this discussion:

    PS. Please post a question only once!

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

  • edited 2:28PM

    Thank you for your reply.
    I've read that discussion and tried it, but than I can't present a picture simultaneously with a question anymore.
    Do you think it is possible using advanced_delay? I've tried this, but than the participants can't type anymore.

    PS. I will post my questions only once. I'm sorry for posting this one twice.

  • edited 2:28PM

    When you insert an advanced_delay, the experiment simply pauses for the duration of the delay. You won't be able to do anything in parallel, such as recording participant responses.

    In your case, you will need to implement your own custom text input item with an inline_script, which uses a timeout and displays text on top of a sketchpad (so that you can show a picture at the same time). This sounds more complicated then it is, though. The basic script is available here (see this post for more comments):

    A slight modification for your specific case (and recent versions of OpenSesame) gives this script:

    from openexp.canvas import canvas
    from openexp.keyboard import keyboard
    timeout = 10000 # Your timeout value
    my_canvas = canvas(self.experiment)
    my_keyboard = keyboard(self.experiment)
    resp = "" # Here we store the response
    start_time = self.time()
    while self.time() - start_time < timeout:
        # Get a keyboard response
        key, time = my_keyboard.get_key()
        # keyboard.to_chr() converts the keycode to a description,
        # like 'space' or 'return'. If return is pressed the loop
        # should be exited.
        if key == "return":
        # Handle backspace by removing the last character
        if key == "backspace":
            resp = resp[:-1]    
        elif key == "space":
            resp += " "
            # The built-in chr() converts the keycode to a character,
            # like ' ' and '/'.
            resp += my_keyboard.to_chr(key)
        # Copy the canvas from a sketchpad called 'my_sketchpad' and
        # overlay the response
    # Save the response
    self.experiment.set("response", resp)

    It's not ideal, but until a timeout functionality has been implemented for forms (issue), a little inline scripting is required.


    There's much bigger issues in the world, I know. But I first have to take care of the world I know.

Sign In or Register to comment.