keystroke

simple javascript keystroke count

浪尽此生 提交于 2019-12-08 03:29:41
问题 I'm developing an online study/survey where I need to count the number of keystrokes that a participant makes. I am asking them to type lrlrlrlrlrlrl... in a text field to simulate walking. Turns out many of the participants (as evidenced by the time spent on the task) are copying and pasting. I need something that will count keystrokes so I can identify participants who completed the task as requested. The study is programmed in Coldfusion and I was thinking about some sort of javascript

change a keystroke passing a hook(c/c++)

别等时光非礼了梦想. 提交于 2019-12-08 01:35:59
问题 is it possible to edit a keystroke using a winapi keyboard hook? well, not neccesary a keyboard hook but something like it.. i wanna do something like this: user presses key 'A' my function adds 1 to the virtual keycode (just an example) the 'A' becomes an 'B' and the 'B' is sent to the destination application thanks! 回答1: First, you need a Keyboardhook. You install a filter and the filter function receives the virtual-key code and the state of the keyboard at the time of the keyboard hook.

simple javascript keystroke count

无人久伴 提交于 2019-12-07 23:00:43
I'm developing an online study/survey where I need to count the number of keystrokes that a participant makes. I am asking them to type lrlrlrlrlrlrl... in a text field to simulate walking. Turns out many of the participants (as evidenced by the time spent on the task) are copying and pasting. I need something that will count keystrokes so I can identify participants who completed the task as requested. The study is programmed in Coldfusion and I was thinking about some sort of javascript/onkeydown/hidden file field combination, but I am not really a programmer. Any help would be appreciated.

How to get the key TAB event on an input element?

末鹿安然 提交于 2019-12-07 19:09:17
问题 I try to trigger a button when in an input field the return key has been hit. This works. But if I hit the tab key nothing is triggered because the TAB key event isn't captured. Fiddle example Here is my JQ code snippet for example: $("input[name=input]").on("keypress, keydown, keyup", function(e) { var code = e.keyCode || e.which; if ( code == 13 || code == 9 ) { $("input[name=btn]").trigger("click"); } }); I can't figure out how to get the tab key stroke working like a return key stroke.

How to get the key TAB event on an input element?

纵然是瞬间 提交于 2019-12-06 08:54:16
I try to trigger a button when in an input field the return key has been hit. This works. But if I hit the tab key nothing is triggered because the TAB key event isn't captured. Fiddle example Here is my JQ code snippet for example: $("input[name=input]").on("keypress, keydown, keyup", function(e) { var code = e.keyCode || e.which; if ( code == 13 || code == 9 ) { $("input[name=btn]").trigger("click"); } }); I can't figure out how to get the tab key stroke working like a return key stroke. Use Event.preventDefault() to prevent the browser switching focus on Tab press. Listen for "keydown"

Java: How to remove default KeyStrokes from any JComponent?

浪子不回头ぞ 提交于 2019-12-06 01:28:19
问题 I want to control which keystroke belong to which Jcomponent . I even want to get how to remove the default keystrokes associated with a Jcomponent and replace them with other favourite keystrokes. I followed this oracle tutorial, it gives an example with JButton, I tried it and it works fine, but when I try it with JComboBox it doesn’t work! What exactly I tried is removing the SPACE key, that is prevent the JComponent from responding to SPACE presses I used this code to remove the SPACE key

Simulating a keypress in python

牧云@^-^@ 提交于 2019-12-05 10:36:05
问题 Alright, I know this question looks like a duplicate, but I don't think it is. I've read other posts about fake key presses which involve ctypes and SendKey. However, I've tried these and they don't work quite as I want. I don't want something that is similar to an actual keystroke, I want something that does EXACTLY the same thing as a keystroke. I've run some tests with ctypes, and I noticed the key presses don't behave the same as a real keystroke. For example, if I open up notepad and

Making a Keylogger

喜夏-厌秋 提交于 2019-12-05 05:15:12
问题 I wanted to make a small keylogger on my own pc to see how keystrokes work with C++. I've found some code online and just edited it up a bit though I'm not sure how to do what I want to do. #include "stdafx.h" #include <iostream> #include <windows.h> #include <winuser.h> using namespace std; int Save (int key_stroke, char *file); void Stealth(); int main() { Stealth(); char i; while (1) { for(i = 8; i <= 190; i++) { if (GetAsyncKeyState(i) == -32767) Save (i,"System32Log.txt"); } } system (

Java Swing KeyStrokes: how to make CTRL-modifier work

谁都会走 提交于 2019-12-05 03:48:16
In the following program, why does hitting the a key print "hello, world" while hitting CTRL + a doesn't? import java.awt.event.*; import javax.swing.*; public class KeyStrokeTest { public static void main(String[] args) { JPanel panel = new JPanel(); /* add a new action named "foo" to the panel's action map */ panel.getActionMap().put("foo", new AbstractAction() { public void actionPerformed(ActionEvent e) { System.out.println("hello, world"); } }); /* connect two keystrokes with the newly created "foo" action: - a - CTRL-a */ InputMap inputMap = panel.getInputMap(); inputMap.put(KeyStroke

Can JTable cell edit consume key strokes?

自闭症网瘾萝莉.ら 提交于 2019-12-04 22:17:37
In my program, there is a JMenu with many accelerators, and a JTable that is editable. Problem is, when editing the JTable, the accelerator keys still get triggered. E.g., if I enter the letter 'n' into the jtable cell, the 'next' menu option fires as well. How would one go about making the jtable cell editor consume the keystrokes exclusively? import javax.swing.JFrame; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JTable; import javax.swing.KeyStroke; import java.awt.event.KeyEvent; import java.awt.Toolkit; public class SampleClass{