Dear Christopher Stawarz,
I’m Pinar, PhD student of Stefan Treue’s at the German Primate Center. We have been conducting a study together with Antonino Calapai and have some questions regarding a potential MWorks functionality.
We’d like to run MWorks at one of our psychophysics setup only to collect information on mouse coordinates and to track the eye movements via Eyelink. It works perfectly usually but now we’re trying to run these functionalities while running another task via another software. As we’re planning to run these sessions to compare our results with a previous study which we conducted with MWorks only, we’d like to keep the conditions as similar as possible and still track and record the eye movements with MWorks. The reason for saving mouse coordinates is to be able to synchronise eyelink data with the data we’d obtain from the other software.
We have tried running an MWorks task in the background but keeping the window of the other software in the front. Then, MWorks doesn’t collect the mouse coordinate information anymore. Would you be able to help us with this? Alternatively, if there’s another easier way of doing such synchronisation, we’re more than happy to hear about it.
I hope it’s clear but if not, please feel free to ask.
Thank you very much in advance!
We have tried running an MWorks task in the background but keeping the window of the other software in the front. Then, MWorks doesn’t collect the mouse coordinate information anymore.
Yes, that’s a basic fact of Mac applications: If the cursor is in another app’s window, then MWServer isn’t going to receive any mouse-tracking events. You could make the MWorks stimulus display fully transparent and have the other application underneath it, but then that application won’t receive mouse events, which presumably won’t work, either.
If it would suffice to track only mouse clicks (not position), you could use a USB HID device to monitor input from the mouse. USB HID input monitoring happens at a lower level than the monitoring performed by a mouse input device, and it remains active regardless of which application is receiving mouse events. However, it isn’t very helpful for position tracking, because it reports only position changes in a coordinate system with no obvious connection to screen coordinates.
I’m not sure what else to suggest. Can the other application receive messages over a network connection? If so, then you might be able to use Python to send synchronization signals to the application (or, alternatively, send sync signals from the application to MWorks).
Thank you very much for your quick reply and for the suggestions!
I believe using a USB HID device is a really good idea and seems to be enough for our purpose as we’re not necessarily interested in the exact position of the mouse for our task but only in the timepoints of mouse clicks. I’ll give it a go and will try it out as soon as possible.
Thank you again!
I believe using a USB HID device is a really good idea and seems to be enough for our purpose as we’re not necessarily interested in the exact position of the mouse for our task but only in the timepoints of mouse clicks.
Sounds good. In case it helps, here’s the basic MWEL code for receiving mouse clicks via USB HID:
var mouse_down = 0
usbhid_generic mouse (
usage_page = 1
usage = 2
autostart = true
usage_page = 9
usage = 1
value = mouse_down
Thank you for the code. That indeed helps a lot!
Have a nice weekend