Questions tagged [keystroke]

The generic concept of capturing or generating a keystroke event in an application.

The generic concept of capturing or generating a keystroke event in an application.

May also refer to library-specific keystroke-capture code, for example questions relating to capturing keystrokes using jQuery.

531 questions
39
votes
3 answers

How do I send key strokes to a window without having to activate it using Windows API?

    I have made an application already that sends commands to an activated window. I want to be able to use the computer while my process is running because as soon as I switch focus to another window the key strokes being sent via send keys will go…
SlipToFall
  • 415
  • 1
  • 4
  • 8
34
votes
6 answers

Application wide keyboard shortcut - Java Swing

I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution. Anyone has a cleaner…
Louis Jacomet
  • 13,661
  • 2
  • 34
  • 43
33
votes
5 answers

AppleScript Application is not allowed to send keystrokes

I made an app with AppleScript called FRIDAY. When I tell it to 'open chrome', it opens google chrome, this is working on Script Editor and out side of script editor. I can also tell it to 'open a new tab' and it opens a new tab using keystrokes: --…
25
votes
6 answers

focus() not working in safari or chrome

I have a div that has been given a tabindex, when the div is focused(click or tabbed to) it does the following: inserts an input into itself, gives the input focus this works great in FF, IE and Opera but in Chome/Safari it gives the input focus but…
BinarySolo00100
  • 1,005
  • 3
  • 12
  • 18
21
votes
6 answers

Simulate keystroke in Linux with Python

How can I simulate a keystroke in python? I also want to press multiple keys simultaneously. Something like: keystroke('CTRL+F4') or keystroke('Shift+A')
microo8
  • 3,568
  • 5
  • 37
  • 67
20
votes
3 answers

How can I get keystrokes to be displayed on-screen in VS Code?

How can I get the keystrokes I enter to be displayed on-screen in VS Code? This would be for presenting or doing screencast.
user847990
17
votes
5 answers

Simulate keypress using Swift

I'm searching for a way to simulate keystrokes in OSX. I found another solution (Simulate keypress for system wide hotkeys) using Objective-C, but i need to do it with Swift. How can i adapt CGEventCreateKeyboardEvent?
ixany
  • 5,433
  • 9
  • 41
  • 65
14
votes
5 answers

Send keystroke to other control

Easy one for you guys. I have a textbox on top of a listbox. The textbox is use to filter ther data in the listbox. So... When the user type in the textbox, I would like to "trap" the down/up/pagedown/pageup keystrokes and fowarding them to the…
vIceBerg
  • 4,197
  • 5
  • 40
  • 53
13
votes
7 answers

Preventing "Enter" from submitting form, but allow it on textarea fields (jQuery)

$(window).keydown(function(event){ if(event.keyCode == 13) { event.preventDefault(); return false; } }); The above is the code I got which effectively kills the "enter" key as a form submitter throughout the system, which is…
jeffkee
  • 5,106
  • 12
  • 44
  • 76
13
votes
4 answers

How to intercept capture TAB key in WinForms application?

I'm trying to capture the Tab key in a Windows Forms application and do a custom action when it is pressed. I have a Form with several listViews and buttons, I've set the Form's KeyPreview property to true and when I press any other key than tab, my…
Axarydax
  • 16,353
  • 21
  • 92
  • 151
12
votes
2 answers

Capture any kind of keystrokes (aka keylogger), preferably c# .net but any kind will do

I need to capture everything that I type on my keyboard and then store it in numerous ways. I'd prefer it to be written in C# for .Net, but anything will do really. My reasons to write this "keylogger" are simple: Recently I became an owner of a…
Istrebitel
  • 533
  • 3
  • 6
  • 8
12
votes
5 answers

Python code to cause a backspace keystroke?

I keep finding ways to map the backspace key differently, but that's not what I'm after. I'm in a program writing a python code, and basically I want to write a line of code that causes the program to think someone just hit the Backspace key in the…
aescript
  • 1,775
  • 4
  • 20
  • 30
11
votes
7 answers

Differentiate between key pressed and key held

I have a javascript function which runs when the 'down' key is pressed. I would like, that if the 'down' key is held down, the function would not run at all. I thought about timing between keydown and keyup, if the time is less than 1 second then…
Tom
  • 927
  • 3
  • 12
  • 20
11
votes
3 answers

Java Swing KeyStrokes: how to make CTRL-modifier work

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 =…
Thomas
  • 17,016
  • 4
  • 46
  • 70
11
votes
3 answers

How do I send key stroke Enter in Watir

I need to automate the action of hitting 'Enter' key on keyboard after entering a text in a text field. I tried @browser.send_keys :enter but that does not do the action. also have tried @browser.text_field(:name => 'q').send_keys :enter or…
user1771980
  • 207
  • 3
  • 8
1
2 3
35 36