Disabling ALT menu bar activation with AutoHotKey not working on Windows 8 - windows-8.1

I've tried using ~LAlt Up:: return in my AutoHotKey script.
But to no avail the menu bar still gains focus when I lift the key up.
Why does this trick work on other systems but not mine?
Or am I doing something wrong?

Try this:
LAlt up::
If (A_PriorKey = "LAlt") ; If LAlt was pressed alone
return ; do nothing
return
; In this case its necessary to define a custom combination by using "LAlt &" or "<!"
; to avoid that LAlt loses its original function as a modifier key:
<!F4:: Send {Alt Down}{F4}{Alt Up} ; <! means LAlt
EDIT:
This works in AHK v1.1.28+ without disabling Alt + click or wheel:
~LAlt::Send {Blind}{vkE8}

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

Pyautogui - When using code that use special keys, the key seem stuck at times

I am getting a weird behavior while using pyautogui hotkey; where the special key used at times does "stick" and cause the subsequent text printed with pyautogui.typewrite() function to be printed incorrectly.
For example, this statement ran on OSX will cause shift to stick at random; causing the output to be printed capitalized.
pyautogui.hotkey("command", "shift", "f")
time.sleep(3)
pyautogui.typewrite("reference_file2.txt")
This will open the "recents" window in Finder, wait 3 seconds then will type a filename which should (or should not be) in the recents window. Sometimes the output of typewrite is printed like if Shift key was pressed.
So instead of
reference_file2.txt
You will see
REFERENCE_FILE#>TXT
which is exactly what you get if you type the original string with Shift key pressed.
Is this a bug in the hotkey function of pyautogui? Or am I supposed to do something to ensure that the keys pressed with hotkey is released, before moving on with the next statement? The documentation of pyautogui specify that the hotkey function does equal to a keypress and keyrelease sequence, so no action should be required, right?

Ctrl Right and Ctrl Left doesn't move from a word to another in Fish Shell

When I use my Fish Shell on Linux Mint, using the Ctrl+Left or Ctrl+Right keys isn't moving the cursor to the previous or next word. It switches between an I and an N instead:
Here is the I and then the N:
I cannot do partial completion then, so it's really boring.
How can I fix this?
Glenn Jackman's comment is correct - you are using vi-mode.
Some third-party prompts (e.g. from Oh-My-Fish or similar) enable it for some reason.
To switch back, usually executing fish_default_key_bindings once interactively should suffice once you have deleted the offending line or package (search for fish_vi_key_bindings).
Or, if you like vi-mode, you can add a binding. Create a function called fish_user_key_bindings (e.g. with funced).
The content should look like this
function fish_user_key_bindings
bind -M $mode $sequence $command
end
where "$command" here would be "backward-word". $mode would be the vi-mode you want the binding to be valid for, e.g. "insert" or "default" (what vi would call "normal" mode).
"$sequence" would be the text sequence that the terminal sends to fish whenever this key combination is pressed. Unfortunately they aren't standardized, so you need to figure out which it is on your system.
fish_key_reader is useful here - execute it, press the combination and use what it tells you. On my terminal ctrl+left sends \e\[1\;5D (and ctrl+right sends the same with C instead of D).

g++ : How can I get keystate on linux

I Want to get keystate for some key like shift. If I press "a" with shift to write "A" then by g++ program on linux how can I ensure that shift is also pressed while I press key "a".
Thanks in advance.
See the answer for this question: What is Equivalent to getch() & getche() in Linux?
It will give you the correct keycodes, i.e. 'a' if you press 'a' with shift depressed, 'A' if you press it with shift pressed, etc. Getting the state of the shift key alone is a different matter though, I'm not sure if there's an easy way to do that.

How to define an action of scroll lock pressed in inittab?

I want a specific shell-script to be executed when I press the scroll lock key on my keyboard (I am using openSUSE 10.2). For this I want to edit the inittab (under /etc/initab/) like this:
cb:12345:kbrequest:/home/user1/script.sh
(the syntax for this is: id:runlevels:action:process - see man inittab or http://unixhelp.ed.ac.uk/CGI/man-cgi?inittab+5)
But now I still don't know how or where to define my scrolllock key. The manual page says something of a keymap file. Where to find this?
And what to insert there? Is it: keycode 70 = KeyboardSignal ?
Looking forward to your replies!
Try:
$ echo 'keycode 70 = KeyboardSignal' | loadkeys
man loadkeys (in kbd package probably) will give you more info.

Resources