AutoHotKey script activates only on numpad enter - autohotkey

My script is only activating when I press the numpad enter, is it possible for it to work if I press the big enter?
Here is what I have, when I type test + numpad enter then it invokes ctr+shift+u
:*:test`n::test^+u
I need the other enter to work or both if possible.
Thanks

I tried this:
:*:test`n::bob
And it types bob no matter which enter key I push. If you use n, that doesn't necessarily indicate that you are pushing anyenterkey - it just means you are inserting a carriage return - so eitherenter` key will do that. But your text area must be able to receive and insert a carriage return.
That means, that if you are working in a single-line text box, it can't receive a carriage return, in which case, using `n won't work for you.
You might also assure that the active window is able to receive ^!u and do something with that.

Related

AHK for enter and arrow key

Can't seem to find this simple script anywhere. I'm trying to create a script that runs when the enter and right arrow key is pressed.
Here's what I've tried so far:
{Enter}{Right}::
Send, #tab
return
I know it must be something really simple but can't find the solution anywhere!
Here's the documentation link for hotkeys:
https://www.autohotkey.com/docs/Hotkeys.htm
And in there, after understanding the basics, you're interested in this part of it:
https://www.autohotkey.com/docs/Hotkeys.htm#combo
And assuming by #tab you mean pressing Windows key and the Tab key, you want to look at this page of the documentation:
https://www.autohotkey.com/docs/misc/Remap.htm
(If you wanted to use the Send command, it'd be Send, #{Tab})
You should end up with this:
Enter & Right::#Tab (have to press enter before right arrow key)
And that works, though you're probably going to want to add one little addition, which the ~ modifier.
It'll make it so your Enter key also works on itself while the script is active.
So you'd end up with this:
~Enter & Right::#Tab
Though, now you'll always send a Enter keystroke every time you run the hotkey, which might not be good, I recommend switching it around to:
~Right & Enter::#Tab

How do I force Windows to ignore an AutoHotKey and instead pass that hotkey directly to the active window?

My cPanel has a text editor that allows multi-cursor functionality using Ctrl-Alt-Up, Ctrl-Alt-Down, Ctrl-Alt-Right, and Ctrl-Alt-Left. Unfortunately, Windows has default hotkeys for these key combinations that rotate the display on your screen. When I try to use these key combinations in the text editor, Windows hijacks them before they can get to the active window.
I first searched to see if there's any reasonably easy way to turn off specific Windows default hotkeys. My search only turned up results that turn off all hotkeys. I then decided to download AutoHotKeys and see if I could write a script to achieve what I was looking to do. Below are some examples; I'll stick with Ctrl-Alt-Right just to select one out of the four:
First block of code is the same in all 4 attempts:
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
SetTitleMatchMode, 2 ;this and the next line should only perform the scripted
#IfWinActive Opera ;hotkey if the active window's title contains 'Opera'
Attempt 1: Hotkey correctly bypasses Windows default display-rotating action, and sends the keystrokes to the text editor in Opera. However, the text editor enters the string "ight" wherever the cursor is. There is no Ctrl-Alt-R hotkey in the text editor, and it must not be a Windows default hotkey either. So it sends Ctrl-Alt-R to Opera, which does nothing. Then it sends "ight" which is typed out. (This is the "most successful" of the 4 attempts, but definitely does not achieve the desired outcome):
^!Right::
Send, ^!Right
return
Attempt 2: Only differs from #1 with SendPlay instead of Send. The Hotkey again correctly bypasses Windows default display-rotating action. However, the text editor does not appear to do anything at all:
^!Right::
SendPlay, ^!Right
return
Attempt 3: Back to just Send, but now with curly braces around the second "Right". Now the hotkey doesn't even bypass Windows default display-rotating action (this truly boggles my mind because I would have thought that the result of Attempt #1 proves that the active Opera window was found and the keystroke Ctrl-Alt-Right is correctly being read by the ^!Right in the first line. I'm so confused why adding the curly braces in the 2nd line is negating these things that seem as if they should already have occurred):
^!Right::
Send, ^!{Right}
return
Attempt 4: Only differs from #3 with SendPlay instead of Send. The Hotkey again correctly bypasses Windows default display-rotating action. However, the text editor does not appear to do anything at all:
^!Right::
SendPlay, ^!{Right}
return
To summarize:
----------| Curly Braces | No Curly Braces |
----------|------------------|-----------------------------|
Send | Win Dflt Action | types "ight" in text editor |
SendPlay | no action | no action |
So here's the final question, based on this table, it would appear to me that Send is definitely the way to go. If (as Attempt 3 appears to indicate) the curly brace is causing the display-rotation, how do I send this keystroke to the active window without Windows hijacking it? Obviously, #IfWinActive Opera is working correctly when the curly braces aren't used. Perhaps there is another directive that prevents or bypasses Windows' default action entirely?
If you don't wish to have the screen rotation functionality, this can be disabled in your graphics panel. I believe it's associated with Intel graphics application. It might be something like, right-click the desktop, select graphics options, choose hotkeys, then click disable. This is just guessing as I don't have that on the computer I'm using, but I've encountered it on others' computers before.
As for your hotkeys, you need the curly braces around the word "right" or it will just send the individual characters, just like actually typing it. Another issue is that you need a $ in front of your hotkey since it is self-referencing; that is, it's sending the same keystrokes that activate it.
If you haven't had a chance to check out the help file, I definitely recommend it.
https://www.autohotkey.com/docs/Hotkeys.htm#Symbols

AutoHotkey: How can I paste text into this particular textbox?

Using AutoHotkey, I have a very tiny script to write text:
^m::
SendInput Foo
Return
This works in most places like Notepad and chrome. However, it doesn't work for a particular program I am using. The program has a simple textbox which I can type text into. The program is called TextExpander. I am making sure the cursor is located in the textbox. For some reason, I can't get auto-hotkey to type text into it.
Any help? Tips?
You can look at ControlSetText. Use WindowSpy to check the control name. If it has one, you can use that to set the text.
Alternately, make sure you're trying SendInput/SendEvent/SendPlay.
If you have a way to reliably focus the box you're trying to enter text to, you can put your variable onto Clipboard and send paste via Ctrl+V SendInput, ^v.

Autohotkey, putting "D89dl" at the end of a sentence doesn't work as intended

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

AutoHotkey SendInput Problems

[Key Mappings of New Media Remote]
http://i.stack.imgur.com/ivMSK.png
Using AutoHotkey I want to interrupt Keyboard Keys sent like AppsKey and Browser_Home and send another key instead. Unfortanately the best I can manage is to send a key as well as the key function.
F3::SendInput {a}
Browser_Home::SendInput {a}
Browser_Home::SendInput a
Browser_Home:: a
The first line 'F3 to a' works as intended; the F3 Key outputs the letter a.
The 2nd and 3rd line Browser_Home only launches Browser to Home.
The 4rd line launches the Browser_Home as well as outputting the letter a.
Anyone know what I'm doing wrong / know how to fix my script to output a without launching browser to home?
According to documentation under Hotkey:
$ is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise
cause it to trigger itself. The $ prefix forces the keyboard hook to
be used to implement this hotkey, which as a side-effect prevents the
Send command from triggering it. The $ prefix is equivalent to having
specified #UseHook somewhere above the definition of this hotkey
Try this and report back: $Browser_Home::SendInput {a}