How to send { character with AutoHotkey - autohotkey

I am trying to send { character with AutoHotkey but following script is not working.
<^>!b::Send,{
Return

The { char has special meaning so it needs to be escaped. Your code would need to look like
<^>!b::Send,{{}
Return
see explanation here

While #garyh provided correct answer to the question asked, it didn't actually solve the problem that made me use AutoHotkey in the first place.
In my case that was fixing Delphi 7 and RAD PHP XE2 on Windows 8.1 where using Alt Gr + B in editor would execute "Show breakpoints window" shortcut (defined as Ctrl + Alt + B) instead of writing { character.
Another way of emitting { character that does work even in above case is
<^>!b::Send,{Asc 0123}
Return

You can also send the { and other special meaning keys by using the raw option
command:
<^>!b::Sendraw, {
option:
<^>!b::Sendinput, {raw}{
Hope it helps

Related

how do you select only the entire string in vscode?

I tried looking up this questions but they were for the entire line.
My question is for example let url = "https://robohash.org/hello.png?set=set4";
here, is there any shortcut to select only the url or basically anything enclosed between "". Is it possible?
I just found a magical shortcut :)
For expand selection we can use shift + alt + ->
I had installed a stupid plugin before!
AFAIK this is not possible without an extension. You can download Quick and Simple Text Selection, the use ctrl+k " shortcut.
If you're familiar with Vim, you can use the vim extension, and then click v i " to enter visual mode, and choose everything between double quotes
For the sake of completeness, vscode also includes a smart select option, which has the keyboard shortcuts ctrl+shift+right_arrow and ctrl+shift+left_arrow (The shortcut has been changed to alt+shift+left/right_arrow). The problem with it is it doesn't specifically select everything between double quotes, and in the case of a URL, it doesn't simply work as intended. If it's only a simple string, it would also select the double quotes in addition to the string between them
There is actually another expansion called expand_region with the ability to
expand_region and undo_expand_region. The default keybindings are ctrl+w / shift+ctrl+w .
I find this one to be more convenient.
It stops before and after " and it will work for the url-fetch scenario.
What it doesn't do is to stop at a complete line (with and without indentation) which smart select seems to do. There are probably more differences that I don't know about.
Update: You have to press multiple times to expand further. For the example line in the original post this means 3 times.
ctrl+w, ctrl+w, ctrl+w
let url = "https://robo[cursor-here]hash.org/hello.png?set=set4";
1. https://robohash.org/hello.png?set
2. https://robohash.org/hello.png?set=set4
3. "https://robohash.org/hello.png?set=set4"

Autohotkey: remap ctrl + {

I want ctrl + { to work as the home key.
This doesn't work:
^{::Send {Home}
I guess the { needs to be escaped?
This also doesn't work: (it generates an error on loading the script)
^{{}::Send {Home}
What is the correct way of doing this?
You can use the steps listed here to find the scan code and virtual key code of the { and then use either of those (SCnnn or VKnn) in the hotkey definition.
Even though that works I was curious why the ^{ doesn't work for your layout, so I tried using it and seeing if AHK's key history showed {, which it does. I took a look at AHK's source code to see what's happening, and I think it comes down to the return value of VkKeyScanEx called with { and your layout, which is 0x0634, i.e., AltGr+4. I hadn't noticed that AltGr+4, AltGr+5, and AltGr+9 all produce { in your layout before this, so I tried the ^{ hotkey again and sure enough it fires with AltGr+4. So it seems it's just a limitation of VkKeyScanEx: even if multiple combinations map to some character only one of them can be returned. In your .klc file, wherever LEFT CURLY BRACKET first appears will be the combination that VkKeyScanEx returns. I don't know if you use the AltGr combinations for {, but if you remove them from your layout the ^{ hotkey should work for just Ctrl+{.

Spell Check All of the Same Word In Eclipse

I am working on a program written by someone else and in their method headers a word is spelled wrong, repeatedly. When I hover over the word I get options to add the word to the dictionary, Change to '...', and more. However, I don't get an option to replace all instances of the word misspelled at once. Is there a way to achieve this in eclipse?
May be replace all ? (using ctrl + F or Ctrl + H)
but it could be dangerous and have side effects...
be sure to have some tests in place !
Or Replace/Find using Ctrl+F. it helps you to jump to the next occurence of the word, so you can check before replacing.

Stop text being sent to editor

Below script opens a browser to www.google.com
But the keys "ch" are sent to the editor window.
~c ::
~h::
If (GetKeyState("c","h") && GetKeyState("c","h")) {
Run, "www.google.com"
Return
}
Return
How can the script be amended so that no output text is sent to the editor ?
Alternatively can focus be removed from the current text editor (for example notepad) ?
I think one of these two versions does what you need:
Version 1
c::
h::
If (GetKeyState("c") && GetKeyState("h")) {
Run, "www.google.com"
}
Return
Version 2
~c::
~h::
If (GetKeyState("c") && GetKeyState("h")) {
Run, "www.google.com"
}
Return
Your mistakes:
Take a look at documentation of GetKeyState command. First function parameter is name of the key you wish to check and second parameter is mode in which GetKeyState command should work. In your example "h" parameter is incorrect parameter.
Also you don't need two returns.
Here ~c :: space will give you error. It should be like ~c::
Also, always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!
Edit:
If the hotkey has prefix ~ then when the hotkey fires, its key's native function will not be blocked (hidden from the system). So, if we write ~c:: , when you press c then it will act as a hotkey in your script and also c will be send to active window. If we write c:: , when you press c then it will act as a hotkey in your script but nothing will be send to active window. Also look here in the table for more details.

Monodevelop curly braces (or brackets) and ALT keypad numbers

Good day all,
I realize this is an ugly subject, but I'm desperate to find a solution since this bug is barring me from using javascript in the editor.
Basically, the only way I can type the curly braces { and } is to use their corresponding numeric keypad codes, ALT + 1 2 3 and ALT + 1 2 5, however when I press ALT and a number, monodevelop will just jump to the open script in the current window, where ALT 1 switches to the leftmost script.
To add insult to injury, code templates don't work either. If I right click the editor area and select 'insert template' from the context menu, nothing happens! Additionally, the shortcuts window doesn't even have an "ALT + number" combination, so I can't get rid of it to see if that's the cause of the problem!
I am thus practically unable to use monodevelop to code with javascript, so I am here hoping that anybody knowledgeable with monodevelop can explain what's the problem, or propose a workaround (I've read about code snippets or other advanced functions, but without more insight can't tell if they can help me or not).
I am using monodevelop 2.8.2, but I've tried 2.6 and the problem is the same.
Thanks in advance.
Through much indirect searching, I've found out that there's an additional 'special key' combination, consisting in
ALT GR + SHIFT
Specifically, ALT GR + SHIFT + [ or ] will output { or }.
Hopefully this might help some of you with a similar issue.