How to make PsychoPy starting another application to measure posturography on the same computer

Dear all,
I have a very specific need that has been maybe addressed before by others. Basically, I’d like to use the same computer to present visual stimuli through PsychoPy and measure posturography through another application. My wish would be to synchronize visual stimuli presentation and data acquisition. Basically, I could have the data acquisition software ready to begin (usually by clicking on a record box from a user action. Od you think it is possible to add instructions in a PsychoPy script (like sending a TTL signal to another computer but here we would have the same computer) to tell the program to “click” the record button in the other application instead of the user through a mouse click?
Maybe I am not clear enough?
THank you very much in advance for your help,
Best regards,

Hi Harold,

the solution heavily depends on what options the recording software offers to invoke the recording process (in general would it be possible to use TTL instead of mouse to start the recording? do they have any api option on the software to start without the button? or could you use some terminal command to start the software in recording Modus?)

On Windows, Autohotkey is relatively easy to control by a python script command and this can (at least if the recording software “start button” is on another monitor) invoke a automatic click on the recording button.

If you rely on exact timing, you should probably try to match system timestamps.

Your problem is more related to the posturography recording software than to PsychoPy itself.

But invoking a kind of system command from within a psychopy experiment is possible and with more information on the used software and a more detailed description of the current process there is definitely a solution to your problem.

Hi Luke,
I thank you very much or your response. In practice, we’ll use a Wii Balance Board connected by bluetooth to the computer. There are many programms that do the same thing, that is recording the signal from the four gauges at the bootom of the platform and calculating the coordinates (through equations available in the litterature) of the body’s Center of Pressure along the anteroposterior and mediolateral axes. A good app is BrainBlox. It is an executable (I am not good enough to see if the souces files could be adapted) which allows to have a window with a “record” button.

But, one thought. As we plan to be on the same PC (meaning having one common timestamps system for both programs), one could consider that the synchronization is done by construction, what do you think ?

Thank you again,

BrainBlox looks great. I worked with C++/# classes and the Balance Board in 2016. You could in theory build some custom “Start-Recording”-Interface-API by using the source code of the tool. All (Github)-available Python Script which directly record the Balance Board Data are always a little buggy or not as convenient.
BrainBlox itself does not provide any info about API options.

Autohotkey with a second monitor might be the easiest option to allow a kind of “autopressing”.

Just record the Autohotkey script with e.g. this script, during one example manual Experiment-Run: Mouse And Keyboard Macro Recorder - AutoHotkey Community

and then use some custom subprocess call at the beginning of the python script to trigger the ahk script.
windows - How to run an autohotkey script in Python (2.7) - Stack Overflow (This should work in Python 3 as well).
This is an example AHK Script to press the BrainBlock connect button.

Loop, 1

SetTitleMatchMode, 2
CoordMode, Mouse, Window
ActiveMoode = 1
tt = Balance Board Brain Blox ahk_class Qt5QWindowIcon
WinWait, %tt%
IfWinNotActive, %tt%,, WinActivate, %tt%

Sleep, 468

MouseClick, L, 898, 152

Sleep, 1000