Millisecond Forums

Is it possible to track the x,y coordinates of mouse movement?

By ssulli26 - 7/17/2007

Does anyone know of a way to track mouse movement for an extended period of time within an inquisit script?

By seandr - 7/18/2007

No, this isn't currently possible (although you can tell if the user clicks on a particular stimulus located on the screen).

Can you provide more details about what you'd need here? I've got plans to implement continuous output recording in a future release, so it would be great to hear your requirements.


By marci - 5/1/2008

It would be really good if I could output the x,y position of the mouse click into the data file.
By seandr - 5/2/2008

Can you say a little more about what kind of task you are running and how you would use x,y coordinates? 

For example, do you simply want to record the latency and position of the mouse at the time the subject clicks one of the mouse buttons? Or do you want to record a continuous stream of x,y coordinates during a trial? Or something else altogether?


By joebodle - 2/10/2011

Hello Sean,

I am trying to create a Visual Analogue Scale. There are a couple of ways to do this. The way we would like to do this is to display a picture of this scale (which has a color gradient) and record the position on the screen where the participant clicks (the X,Y coordinates). We cannot use the sliding scale because it starts people in the middle, and we are recording latency as well.

Is it possible to record the x,y coordinates of a click and the response latency?

I am using Inquisit 3.0

Thank you,


By Dave - 2/10/2011

See the sample script I posted in this thread: You should be able to adapt it to your needs fairly easily.


By joebodle - 2/10/2011

Hi Dave,

Thanks for responding so quickly. We have the VisualAnlogueScale syntax; this syntax records where on a shape participants click. However we would still like to know if it is possible to just record the x,y coordinates where the participant clicks on a screen? Or, if not, is it possible to record where participants click on a picture (not a shape)?

Thanks again,


By Dave - 2/10/2011

The script of course does track mouse coordinates as you can see in the <expressions>. Anyway, you need to look up the documentation on the responsex and responsey properties.

By joebodle - 2/14/2011

Hi again Dave,

I have looked up documentation on responsex and responsey. Thanks for the tip, but I'm still having an issue. I'm trying to use a picture (instead of the shape that you used) as the visual analogue scale. When I try to run the block, I am still able to use it like when it was a shape, but it will not record the either the x or y coordinates. When I ran the monkey it did record the data but with no coordinates. I used your template and noticed that it was only recording the data with a monkey run as well (without changing any of your code) and not when I went through the trials myself.

By the way. I'm using this the picture (instead of a shape) because i need a color gradient for the response scale itself.

I hope this isn't too confusing. I also apologize if my lack of knowledge with this language becomes frustrating to you.

Thanks again,


By Dave - 2/14/2011

To actually record the x,y coordinates, you have to modify the <data> element. The VAS script only records a percentage score adjusted for different screen resolutions, etc.. If you use a shape or a picture as your scale doesn't make any difference. Consider this simplified sample code:

/ x = 0
/ y = 0


<trial mytrial>
/ stimulusframes = [1=blackblock]
/ inputdevice = mouse
/ validresponse = (blackblock)
/ ontrialend = [values.x=trial.mytrial.responsex;values.y=trial.mytrial.responsey]

<shape blackblock>
/ shape = rectangle
/ color = (black)
/ size = (400px,100px)

<block myblock>
/ trials = [1-10=mytrial]

/ columns = [date,time,subject,trialnum,trialcode,latency,response,values.x,values.y]