Menu

Execute Tapping and Simple Response Time tasks with a mouse click

Help
2020-10-21
2021-11-30
  • Jack Rohner

    Jack Rohner - 2020-10-21

    Hello,

    I would like to perform the Tapping and the Simple Response Time tasks with a mouse click. However, I could not figure out how to edit the code in the way that the tasks can be executed by clicking on the mouse. Do you have an indea what command I could use for this?

    Thanks for your help!

     
  • Shane T Mueller

    Shane T Mueller - 2021-11-29

    Jack,
    Neither of this is too difficult, but both are written to look specifically for key presses and the function needs to be replaced to handle mouse events. This is complicated in both cases by the fact that these are done with a timeout, so you need to be able to handle the condition that a response is not made.

    For the tapping task, you need to replace line 184 with some code to look for the mouse keypress instead of keyboard. Note that because the physical switch is different, the results would not be comparable to the keyboard, and I'd worry a little about moving the mouse outside the application window so you need to be sure that this is done fullscreen or mouse movement is disabled.

    For simple RT, the logic is between lines 139 and 153.

    For both of these, you essentially need to replace the WaitforListKeyPressWithTimeout() function with WaitForMouseButtonWithTimeout(), and then check to see if the response is ["<timeout"].

    These are reasonable changes, and I'd like to help you make them, because they would be useful to others. I would need to update the entire scripts so it could be controlled via the parameters, and it would require adding some translateable text, so it would take a few days for me to look at it. You could probably work up a fix to suit your needs on your own, but I'll try to look at it and see what it will take to make these changes.

    Shane

     
  • Shane T Mueller

    Shane T Mueller - 2021-11-30

    For the SRT task, the file below contains the code to allow use of the mouse button. You will also need to update the translation .json file and the parameters file, which I'll attach to subsequent comments. To make it work, you will need to set the 'responsekey' parameter to 'mousebutton' from 'X'. The json file goes in translations\ and the .schema file goes in parameters\

     

    Last edit: Shane T Mueller 2021-11-30

Log in to post a comment.

MongoDB Logo MongoDB