This is for an experiment we are running in our lab. First the script asks for a participant number and creates a file in C: . During the experiment a participant with a gamepad presses a single button (8), and each time the button is pressed the file is written with the current time. The q button returns a quit message and ends the script.
And it does not work. I think the issue surrounds the joystick. Any help much appreciated.
FormatTime, timestamp, , yyyy_MM_dd_HH_mm
JoystickNumber = 1
#SingleInstance
#persistent
InputBox, ssnum, Subject Number, Please enter the participant number
if ErrorLevel
ExitApp
else
thefilename=%ssnum%_T_%timestamp%
FileAppend,
(
%ssnum%%timestamp%
), C:\%thefilename%.txt
return
Loop
{
GetKeyState, state, Joy8
if state = D
FileAppend,
(
%timestamp%,
), C:\%thefilename%.txt
}
q::
MsgBox Exiting. Your data is saved in the C drive as %thefilename%.txt
ExitApp