Help with Inline Keyboard Press

618 views
Skip to first unread message

Giulia

unread,
Feb 19, 2016, 8:14:23 AM2/19/16
to E-Prime
Dear all,

I am currently programming a new experiment with E-Prime 2.

I need to generate a loop code where the condition is "loop until I press any key on the keyboard" (I am not interested in a specific key).
I know I could ask the loop to wait for the RT of a previous object, but doing so creates a delay on subsequent ones and I need to avoid it.

My question is: how can I tell the script to loop until any key is pressed with an InLine?

Many thanks,

Giulia

MarcL

unread,
Feb 20, 2016, 11:46:37 AM2/20/16
to E-Prime
Hi Giulia,

I don't have E-Basic help here at the time, but I'm pretty sure something like this should work:

Dim press as boolean
Keypress = false

Do

(--- your script ---)

If (Keyboard.GetKeyState("a") = 1) or  (Keyboard.GetKeyState("b")  = 1)....

Keypress = true

end if

Until Keypress = true



I'm pretty sure there will be a possibility to ask for any key, but this you have to find out for yourself as of now ;)

Marc

Prasad

unread,
Feb 20, 2016, 2:00:44 PM2/20/16
to E-Prime
Stimulus.InputMasks.IsPending is the flag I use to wait for a response for a user in a while loop.

Giulia

unread,
Feb 24, 2016, 9:35:00 AM2/24/16
to E-Prime
Thank you Marc!

I tried with your script (using loop while false) and it worked! I'm sorry for the silly question but I hadn't been able to find it in the E-Basic help.

Unfortunately though it didn't solve the problem I was experiencing, so I am going to post another question.

Thank you very much for your help!

Giulia

David McFarlane

unread,
Mar 24, 2016, 2:39:55 PM3/24/16
to e-p...@googlegroups.com
Just to flesh this out a little further in case anyone stumbles on this
thread and does not need to do this in InLine code, you may accomplish
much the same thing by using an input mask with a key release -- see the
"{key} nomenclature" and related topics in the E-Basic Help facility.

-- David McFarlane
Reply all
Reply to author
Forward
0 new messages