I have to press a button twice to send my message

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sipiofficial
Posts: 1
Joined: 30 Sep 2022, 15:33

I have to press a button twice to send my message

Post by sipiofficial » 30 Sep 2022, 15:38

Hey!

I just downloaded AHK, and I was trying some stuff with omegle. This is what my code looks like at the moment:

Code: Select all

^!Enter::Run, chrome.exe "https://omegle.com" " --incognito "

SetTitleMatchMode 2
#IfWinActive Omegle
Numpad1::
SendInput, Good morning{Enter}
return
[Mod edit: [code][/code] tags added.]

When I press ALT + Control + Enter --> Omegle opens in an incognito window. Hurray! But when I press 1 on my numpad it types a 1, and when I press 1 again then the command works. but it sends like this: 1Good morning
What could be the problem?
Thank you in advance!

User avatar
mikeyww
Posts: 26600
Joined: 09 Sep 2014, 18:38

Re: I have to press a button twice to send my message

Post by mikeyww » 01 Oct 2022, 06:32

Welcome to this AutoHotkey forum!

I tested your script. It worked here. If your target window was not actually active, then the hotkey would not be triggered, and the usual key would be sent.

Debugging this is straightforward.

Code: Select all

^!Enter::Run, chrome.exe https://omegle.com --incognito

~Numpad1::
WinGetActiveTitle, title
MsgBox, 64, Title, %title%
Return

#IfWinActive Omegle ahk_exe chrome.exe
Numpad1::SendInput Good morning`n
#IfWinActive
Your match mode line never executes, because it follows Return. You can move it to the top of the script.

Explained: auto-execute

Post Reply

Return to “Ask for Help (v1)”