I have a weird typo that I keep making over and over, and instead of actually working on my typing skills, I want to edit my AutoHotkey script to compensate for this.
sometimes when I type the capital I I hit the : button and type "I:" and I want AHK to replace that string with just the letter I.
I already have a similar Hotkey
::custoemr::customer
But since the string uses a colon, I am having difficulty getting it to do what I want.
Any I:deas? (See?)
Yes! It is a work around, but it works...
#Hotstring EndChars :
:?O:I::I
Anything below the line #Hotstring EndChars : will use the : as EndCharacter.
Not sure if this will work for you it changes I:Space into I, but it requires the Space.
:*:I`: ::I ; The `is the escape but with 3 ::: AutoHotKey still get's confused
Related
I searched for hours but can't find a way to swap : with it's shifted key /. I am new to AutotHotkey. Can someone help me ?
colon key with slash (shifted)
Answer for the updated question from comments:
The layout is French AZERTY. The layout has a : key, and if it's shifted, it sends /. These should be swapped around so not shifting would send / and shifting would send :.
So the trick is to just send the other key, when other key is detected. Like so:
#UseHook
:::SendInput, /
/::SendInput, :
Using the keyboard hook #UseHook(docs) is important to make the hotkeys not trigger each other.
Normally this could be done with the $(docs) prefix, but due to bug in the syntax, $::: comes up as a syntax error.
Also, why couldn't the simple remapping syntax be used?
:::/
/:::
It's because the remapping syntax uses the blind sendmode(docs), which would cause the shift modifier to pass through and you'd always end up with the shifted variant of the key.
Technically you can use the remapping syntax for the first hotkey like this:
:::/
/::SendInput, :
This also wouldn't require you to use the keyboard hook, due to DownR(docs) being used in the remapping syntax.
Since we cannot use the typical remap sequence here (i.e. ::), we can instead use the Hotkey command to detect when the Colon is pressed, and then to remap it to a label
Hotkey, :, ColonDetected
return
ColonDetected:
Send, /
Answer based on this post in the AHK forums: https://autohotkey.com/board/topic/99092-remap-colon-key-help/
I'm just starting to learn to use Autohotkey, mostly for text expansion, ie when I type goo and it will become www.google.com. Problem is, in Windows, it always leaves a space in the end and that's annoying. What can I do to avoid that?
I tried added {bs} and {left 1} to the script but it moves the cursor before the last character eg www.google.com
The reason there is a space at the end is because you're pressing space to end your hotstring. If you use the O option, it will omit the ending character. Try this:
:O:goo::www.google.com
More information can be found here in the official help docs: https://www.autohotkey.com/docs/Hotstrings.htm
Found the answer myself! My original code syntax was like this...
::goo ::www.google.com
Doing so leaves a space in the end
I changed it to...
::goo ::
Send, www.google.com
return
Another option is to use :*:goo::www.google.com
The asterisk means that the hotstring will be activated without waiting for you to end the hotstring (though in this case, typing 'good' would pose a problem)
I am using my keyboard to run an application in MATLAB, where each keypress is handled differently depending on the number or letter pressed. To recognize keypresses I'm using the HebiRobotics library discussed here:
Detect Keyboard Input Matlab
While running the program, hundreds of keypresses are required, each of which types a character in the command line, after the >>. Is there any way to delete these characters as they are typed so the command line remains clear? I've tried fprintf('%c',8) to backspace, but this applies to the previous executed command, not the characters on the current line.
To be honest, this isn't terribly important, but having the characters appear is ugly, takes a few extra clicks to delete, and is one of those little things that is driving me crazy.
This answer by 'Oleg Komarov' seems to be relevant -Clearing text typed with input() from command history
Is there a way to include a space in the HotString and still have the space trigger the HotString replacement? For example:
::_u_::_you_ <--where the underscores are actually space chars
or
:*:_fo_r::_for_ <--where the underscores are actually space chars
so if I typed
StackOverflow is a great place fo ranswers!
it would be changed to
StackOverflow is a great place for answers!
I'm looking for a way to define a phrase as the hotstring really.
Strange. I tried escaping with `s but that didn't work. The docs say two things:
To send an extra space or tab after a replacement, include the space or tab at the end of the replacement but make the last character an accent/backtick (`). For example:
:*:btw::By the way `
and
Spaces and tabs are treated literally within hotstring definitions. For example, the following would produce two different results: ::btw::by the way and ::btw:: by the way
So, I would think this should work:
:*: fo r:: for `
That works in notepad, but only if I try it at the start of a line. Mid-sentence it fails.
You may be forced to use one of the user-created dynamic regex hotstring libraries.
Using this library, this works:
#include Hotstring.ahk
Hotstring(" fo r", " for ")
edit:
I asked on the AHK forums, and the ? option should do it:
:*?: fo r:: for `
This will work.
:*: fo r::
SetKeyDelay, -1
Send for{space}
return
I have a Autohotkey script that puts "D89dl" at the end of a sentence everytime I press Enter, but using it with a AutoCorrect script it doesn't work as it should. Let's say you type "dont", it then would look like this "don't" instead of "don't.". Something is blocking it but I'm not sure what it is, I've been trying for months now.
Here are the scripts:
enter::
send,D89dl{Enter}
Return
#Hotstring EndChars -()[]{}:;'"/\,.?!`n `t
::dont::don't
I would be VERY thankful if anyone of you helps me with this.
Overall, do you know any other way instead of Autohotkey that puts "D89dl" at the end of a sentence?
The easiest solution seems to be to use the :*: mode, which will trigger everytime the misspelled word is typed, without the need for Hotstring EndChars:
:*:dont::don't
Instead of using Enter, I suggest you use a special combination of keys that enter the string D89dl and then press Enter. Use a modifier like ctrl or alt and another key. The reasoning is that the key Enter has very important functionality and should not be changed. Pressing that special combination is appropriate, given the very special function it does.
It's a bit hacky, but it should do the job (given that by "end of sentence" you actually meant pressing "Enter"):
~enter::
Sleep, 100
SendInput, {BS}D89dl{Enter}
Return
#Hotstring EndChars -()[]{}:;'"/\,.?!`n `t
::dont::don't