How do I do an Applescript to press control and "1" at the same time? - keyboard

So I'd like to do a macro to press multiple keys in succession. What I have done thus far only actives the 1 key, and the app is not aware of the control key being down. I can trigger the correct behavior manually, but not yet in the script. Ideas?
on run
tell application "T-Engine" to activate
tell application "System Events"
key code 18 using {control down} --1
key code 19 using {control down} --2
key code 20 using {control down} --3
key code 21 using {control down} --4
key code 23 using {control down} --5
key code 22 using {control down} --6
key code 26 using {control down} --7
key code 28 using {control down} --8
key code 25 using {control down} --9
key code 29 using {control down} -- 0
end tell
end run

Related

Allow hotkey that presses a disabled key

My keyboard key/letter f is ruined and continuously presses the letter. I am using AutoHotKey to successully disable the letter, but I need an alternative hotkey to press the key. I have chosen to use CTRL+j as the hotkey to press the letter f. I tried this script but it does not seem to press the key:
f::return
^j::
Send f
return
I also tried this but it also does not work:
f::return
^j::
Send {f down}
return
How can I get the script to press f using the hotkey CTRL+j, while disabling the key f?
The $ modifier is going to solve this problem.
That modifier makes it so that your f::return hotkey wont affect keys that are sent from AHK.
So here's your finished script:
$f::return
^j::SendInput, f
Also switched over to SendInput due to it being the recommended faster and more reliable send mode.
I used the ASCII code for the letters in both uppercase and lowercase, and it also worked:
; disable the key 'f':
f::return
; press CTRL+j to press f:
^j::
Send {Asc 102}
return
; press CTRL+Shift+j to press F:
^+j::
Send {Asc 70}
return

How to type Ampersand with Key '7' Broken using Keyboard?

If this question doesn't suit here, request me , I will take it off.
My keyboard's 7 key got damaged and I can't type ampersand without struggling. I am into C programming and can't buy a keyboard right now. Is there any way I can map it somewhere? I am using Ubuntu OS.
Use xev command to find the keycode of the key you want to use instead of ampersand and run the following command
xmodmap -e "keycode xxx = ampersand"
Where xxx is the keycode you found.

Using Autohotkey to add an artificial delay to a keypress

I am trying to use autohotkey to add an artificial delay to a keypress. I am in a tiled room, with a mechanical keyboard, and a desktop microphone. I would like to add an artificial delay of approximately 1/10 of a second to my PTT key, so that others don't hear the audible CLICK when I press the key. I ended up binding the key to something else "numpad -" so that capslock could be the key I actually press. This is the script I ended up with.
Expected result: pressing capslock presses numpad- on a 0.1s delay, and then holds the key until I release capslock(and it should also unpress capslock on release)
Actual result: It works, but if I press and release it too quickly, it holds "numpad -" down and capslock down, and releases neither.
code:
#UseHook
*~Capslock::
sleep, 100
Send {NumpadSub Down}
sleep, 100
While GetKeyState("Capslock")
{
}
return
*~Capslock Up::
sleep, 300
Send {NumpadSub Up}
return
without the sleeps as is, the program opens the key, closes the key, and then re-opens.
UseHook
Answer:
*~Capslock::
sleep, 100
Send {NumpadSub Down}
keyWait, Capslock, U
sleep, 100
Send {NumpadSub Up}
return

Send key press FROM keyboard without physically pressing any keys - not simulate

I need to send a key press from the keyboard without manually/physically touching the keyboard.
I DON'T want to simulate key press events using SendKeys, or using AutoHotKey, etc. I need the signal to come from the keyboard's usb cable.
This script,
' Open notepad
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "notepad", 9
' Give Notepad time to load
WScript.Sleep 500
'press some letters and capslock
WshShell.SendKeys "Hello World!"
WshShell.SendKeys "{CAPSLOCK}"
types the message, Hello World!, and 'presses' the capslock key causing the capslock led to light up (or turn off depending on the starting position). So I assume I am able to send a signal to the keyboard. How do I get the signal to be sent back?

VIM comma is missing in insert mode

I'm a VIM beginner, and I have a weird problem. I started using vim in a terminal emulator, but today I moved to gVim. Then I realized that I cannot write a comma in Insert mode! I tried :map ,, :imap , both said no mapping found. THen I tried :nomap , and :inomap , both without any luck. As writing the commands, I am able to write the comma, but not in insert mode. What can be the problem?
Some details: I'm running a freshly installed ubuntu 9.04 system, with an english keyboard, but using a hungarian layout. I am able to write a comma in vim when writing into the "command line" of vim, after pressing : in command mode.
remove the 'cindent' line from your .vimrc file. worked for me!
What happens if you type CTRL-V followed by a comma in insert mode? Do you get a comma?
Also, since you only have this problem in gvim and not vim, try running xev and typing , into it to see if the events look odd. (you may need to apt-get install x11-utils for xev) The events I get look like this:
KeyPress event, serial 30, synthetic NO, window 0x4000001,
root 0x236, subw 0x0, time 788140933, (138,120), root:(144,139),
state 0x10, keycode 59 (keysym 0x2c, comma), same_screen YES,
XLookupString gives 1 bytes: (2c) ","
XmbLookupString gives 1 bytes: (2c) ","
XFilterEvent returns: False
KeyRelease event, serial 30, synthetic NO, window 0x4000001,
root 0x236, subw 0x0, time 788141013, (138,120), root:(144,139),
state 0x10, keycode 59 (keysym 0x2c, comma), same_screen YES,
XLookupString gives 1 bytes: (2c) ","
XFilterEvent returns: False
Ok, I managed to solve it. Previously I used mkvimrc to generate my .vimrc. Now, I deleted it all, and created one manually. Not sure what caused it, but now it works as expected. Moral: don't be lazy, write your vimrc yourself. :)
Do you have something like this in your .vimrc set cinkeys=0{,0},:,0#,!,!^F?
I run into this issue and solved it by removing the rogue exclamation mark
set cinkeys=0{,0},:,0#,!^F

Resources