record mouse only when clicked
Jeremy Purcell
purcel14 at gmail.com
Tue Mar 11 16:06:14 UTC 2014
Hello all,
I’m attempting to record/display mouse movements ONLY when the mouse is
clicked, but am having a difficult time figuring out how to go about it.
Below is the inline code that I am starting with. Where the
“CollectResponse” is the name of the text object that is waiting for a
response in a trial.
It would be ideal to not have the mouse click advance this inline code; so
right now the only way to get this code to work is by setting the inputs to
“CollectResponse” to the keyboard (not the mouse). So it waits for the
input to a keyboard input and then it stops recording. This is great…i.e. I
want the keyboard to quite the trial… but the problem is that it won’t
record the mouse clicks this way. It will only let me record the position
regardless of whether mouse is clicked or not. And so I am having
difficulty figuring out how to make a conditional statement where it only
records/displays the mouse movements IF the “Left” mouse button is pressed.
So, are there any ideas regarding how to record ONLY when the “Left” mouse
button is clicked?
I understand that this might be a bit of a novice question, and so at least
being pointed in the right direction would be very helpful. I've attached a
very basic paradigm with only two trials to illustrate the point where I am
at (i.e. right now it records mouse movements whether the mouse key is
pressed or not); oh and btw it is eprime professional 2.0.10.242.
Thank you so much for any input!
'Inline code that I have been working with
'Set filename
Dim strFilename As String
'Declare pointer variable to hold coordinates
Dim ptMouse As Point
'Declare and initialize a variable that will hold the next target time
' to log a coordinate
Dim nLogTime As Long
nLogTime = Clock.Read
'Constant holding the size of the circles used
' to replay the subject's path
Const nRadius As Integer = 5
'Create and initialize Canvas
Dim cnvsReplay As Canvas
Set cnvsReplay = Display.Canvas
'Constant representing the interval at which coordinates will be tracked
Const nInterval As Integer = 10
'Counter variable used to name attributes
Dim nCount As Long
cnvsReplay.PenColor = CColor("black")
cnvsReplay.FillColor = CColor("black")
cnvsReplay.PenWidth = 1
'Loop until a response is made
Do While CollectResponse.InputMasks.IsPending()
'Check if 25ms have passed
If Clock.Read > nLogTime Then
'Increment counter
nCount = nCount + 1
Mouse.GetCursorPos ptMouse.x, ptMouse.y
cnvsReplay.Circle ptMouse.x, ptMouse.y, nRadius
c.SetAttrib "XYTracked" & nCount, (nCount & "," &
Clock.Read & "," & ptMouse.x & "," & ptmouse.y)
Sleep nInterval
End If
Loop
Dim strbmp As String
strbmp$ = strFilename & ".bmp"
Display.Canvas.SaveImage strbmp
--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/b5306857-ffb3-4956-b542-5f4f4af8eda9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20140311/84d1a934/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Writing_recorder_Final.es2
Type: application/octet-stream
Size: 139392 bytes
Desc: not available
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20140311/84d1a934/attachment.obj>
More information about the Eprime
mailing list