Detecting keyboard sequences

marcofilipevieira's picture

Hey there, I need urgent help in this. I'm new in QC, and I passed all day in front of the computer trying to do this. But I still didn't get what I want... :(

So here's the problem:

I want to detect certain keyboard sequences and give them and id. For instance, if I press 4 times "a" key from my keyboard should have an id = 1; And if I press again 4 times the "a" key, it should be id 2. And if I press 2 times "a" key and 2 times "s" key, should be id 3. In other words, every sequence I enter from my keyboard should have different ids, though it could be the same sequence, but should always have a different id.

I appreciate your attention,

Cheers,

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

usefuldesign.au's picture
Re: Detecting keyboard sequences

Are you sure this is the best way for your comp to receive inputs?

How does the composition know when one sequence has started and another has ended?

How does the user know when one sequence has started and another ended?

Do you use prompts, visual feedback (like a password "••••"), time the intervals between keystrokes and test the intervals and the sum of last 4 intervals?

All these questions would effect how I would try to do this but I recommend the Kineme Freeboard patch then you can just parse it's output. You can use a watcher patch to generate a gate for when it's output changes... More info more help. Post a composition if you are able to, it's more likely to be reciprocated with help (based on law of averages and my observations of Kineme Forums).

marcofilipevieira's picture
Re: Detecting keyboard sequences

For this composition it's not important the user to know if the sequence has started or not... I have here my composition. You can see it. I'll try to explain to you what I have. So, in first place I used the Keyboard with the different keys that are going to be used in the sequences. Then, I have a counter for each Key, so I'll know how many times the user pressed that key. Then I have a JavaScript with all the possible sequences. And there I set the ID for each sequence (instead of ID I called "measure" in my composition). So, the sequences are: "aaaa"- measure =1 "aaaa"- measure= 2 (...) "ssss"- measure = 9 (...)

The problem is that when a sequence finishes I have to reset the counting value (for instance, after the user pressed 4 times the "a" key, the value of the "a" key is 4, but as the sequence is finished, I need to reset the value for zero). So, in this case, when the counting value is 4, e put the reset value of the counter patch true. And the problem is, that it remains true! So it doesn't count anymore. =/ So, I need to put it false again, but I don't know how.

Thank you for your time and patience,

when I do the reset of the counting value of the keys after a sequence, the value of reset is always true.

PreviewAttachmentSize
music_follower copy.qtz11.82 KB

Swiftlikeninja's picture
Re: Detecting keyboard sequences

I have a Passcode comp that i developed a while back, it might help get you going on the right track. There is a reset timer based on time of last input received. In its current form enter is required for sequence checking but can easily be changed to a constant evaluation. *added notes within the qtz to switch it over.

Hope this helps

PreviewAttachmentSize
Passcode1.qtz19.86 KB

marcofilipevieira's picture
Re: Detecting keyboard sequences

Thank you guys! You've been really helpful! :D I have want I want, and it's working fine. Thank you again for your time.