keyboard-events

How to respond to password prompt when using SCP in a shell script?

↘锁芯ラ 提交于 2019-11-29 04:13:22
First of all, I am well aware of that there are many of questions regarding this topic. I have read them, but still could figure out an appropriate answer for my situation. I would like to scp the entire ~/cs###/assign1 dir from local to school home dir with a shell script. My question is, is there a way in my script to wait for the password prompt, and then simulate key board event to 'type' in my password? here is a really detailed guide of how to set up the key Are ssh keys not allowed? That would be a better solution. Use "sshpass"! #!/bin/bash sshpass -p "password" scp -r /some/local/path

Catching event when following a link

試著忘記壹切 提交于 2019-11-29 02:06:11
I am trying to track clicks on an external link (without using a "redirect page"). How can I capture an event when a user follows a link, regardless of whether the user: Left clicks on the link Right clicks on the link and open it in a new window Use the keyboard to activate the link Is there other ways to activate a link? The onClick event only applies to the first. If setting href="javascript:fireEventAndFollowLink()" the user will not be able to open the link in a new window (2), so this is not a sollution. Rob W A link can be triggered in some ways (assuming modern browsers, see foot note)

Detect a double key press in AutoHotkey

这一生的挚爱 提交于 2019-11-29 01:06:12
I'd like to trigger an event in AutoHotkey when the user double "presses" the esc key. But let the escape keystroke go through to the app in focus if it's not a double press (say within the space of a second). How would I go about doing this? I've come up with this so far, but I can't work out how to check for the second escape key press: ~Esc:: Input, TextEntry1, L1 T1 endKey=%ErrorLevel% if( endKey != "Timeout" ) { ; perform my double press operation WinMinimize, A } return Matthew Lock Found the answer in the AutoHotkey documentation ! ; Example #4: Detects when a key has been double

Capture Control-C in Python

我与影子孤独终老i 提交于 2019-11-29 01:02:50
I want to know if it's possible to catch a Control-C in python in the following manner: if input != contr-c: #DO THINGS else: #quit I've read up on stuff with try and except KeyboardInterrupt but they're not working for me. Consider reading this page about handling exceptions.. It should help. As @abarnert has said, do sys.exit() after except KeyboardInterrupt: . Something like try: # DO THINGS except KeyboardInterrupt: # quit sys.exit() You can also use the built in exit() function, but as @eryksun pointed out, sys.exit is more reliable. From your comments, it sounds like your only problem

How to hook/remap an arbitrary keyboard event on OSX?

妖精的绣舞 提交于 2019-11-29 00:12:33
I would like to map: CAPS-LOCK to Fn Fn to Left-MOUSE LSHIFT + 3 to # RSHIFT + 3 to something else etc. I have searched exhaustively for any tool that offers complete freedom for remapping keyboard input, but cannot find one. (Windows has AutoHotkey). I'm planning to write my own tool that parses a config file. But how to actually dig in and do this? Solving this problem will require a thorough understanding of the journey of a keystroke through the operating system, so as to intercept at the appropriate point. I think I need to eat the event at a low-level, where it is still a virtual key

How can I send keyboard commands (hold,release,simultanous) with a python script?

寵の児 提交于 2019-11-28 22:08:08
I want to send virtually the command like this: when keypress=="a" #if entered key is "a" send {ALT+TAB} # send ALT and TAB simultaneously sleep(2) #wait for 2 sec send {"I love my Country",0.1} #send all strings at 0.1 sec wait key_down("BACKSPACE",1) #hold down backspace key for 1 sec send{ALT+F4} #send ALT and F4 simultaneously For all, or a particular application, also opengl games as well. I tried SendKeys.py but there is no simultaneously input function and no key_down method for sending holding down a key command. All advice will be greatly appreciated. I know how to do it with ctypes.

Android custom keyboard popup keyboard on long press

瘦欲@ 提交于 2019-11-28 18:22:59
I have custom Android keyboard: public class CustomKeyboard extends Keyboard{...} public class CustomKeyboardView extends KeyboardView{...} public class CustomKeyboardIME extends InputMethodService implements KeyboardView.OnKeyboardActionListener{...} On some keys, I have popupKeyboard and popupCharacters : <Key android:codes="144" android:keyLabel="0" android:popupKeyboard="@xml/key_popup" android:popupCharacters=")" android:keyEdgeFlags="right"/> xml/key_popup.xml: <Keyboard xmlns:android="http://schemas.android.com/apk/res/android" android:keyWidth="10%p" android:horizontalGap="0px" android

Flush/Clear System.in (stdin) before reading

妖精的绣舞 提交于 2019-11-28 14:19:54
At work, we have 5 RFID readers attached to a PC running Linux. The readers are all recognized as keyboards and send their input (what they read form the Chip) as an key-input-event sequence. To be able to tell which reader send what sequence, I'm doing a raw-read over /dev/input/XX and get their input this way. The problem with this is, that the send keyboard-events generated by the RFID readers are still "in" stdin and when I try to read from System.in via Scanner (input should be generated by a normal keyboard this time), I first get the "pending" input from the readers (which consists of

How to tap (hook) F7 through F12 and Power/Eject on a MacBook keyboard

a 夏天 提交于 2019-11-28 12:46:48
This question follows from How to hook/remap an arbitrary keyboard event on OSX? So far I am able to tap the modifier keys and most of the other keys using: _eventTap = CGEventTapCreate( kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, CGEventMaskBit( kCGEventKeyDown ) | CGEventMaskBit( kCGEventFlagsChanged ) , (CGEventTapCallBack)_tapCallback, (__bridge void *)(self)); Notably, F3 correctly reports a keycode (160) before taking action. i.e. I can disable the action by having my event handler return NULL (and thus failing to propagate the event). However, F7 through F12 and

Disable enter key in JQuery ui datepicker

瘦欲@ 提交于 2019-11-28 12:16:20
There seems to be a bug with JQuery UI datepicker, when user manually enters a date, and hits enter, the datepicker closes but focus stays on the field and therefor calendar won't open again until the textbox loses focus and gets it again. How can I supress the enter key behavior? Or are there any other known solutions for this seemingly known bug? Thanks! EDIT After working on this a bit more, this is the solution I came up with: $('#someid').bind('keydown', function(event) { if (event.which == 13) {var e=jQuery.Event("keydown"); e.which = 9;//tab e.keyCode = 9; $(this).trigger(e); return