AHK works sporatically

Get help with using AutoHotkey and its commands and hotkeys
Posts: 2
Joined: 13 Aug 2019, 11:48

AHK works sporatically

13 Aug 2019, 15:17

AHK Unicode 64 Ver

I just started with AHK. I wrote a script with 4 hot keys and compiled it.
The problem: sometimes the hot keys work and sometime they do nothing.
That kind of reliability renders them of little value. Sometimes two will
work and two won't. I never know when I press the hot key if anything will
come out. And sometimes everything will come out except the enter at the
end--and other times the enter will come out. Very mysterious why this
should be so.
Thanks for listenin'.

Here is my script:

Code: Select all

#SingleInstance ignore
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory. 

^t::  ;  ^=CTRL
Send, tedL1234 
Send, {Tab}
Send, Ted324med 
Send, {Return}

^j::  ;  ^=CTRL
Send, janetL2345 
Send, {Tab}
Send, Kwat623jan
Send, {ENTER}

^+r::  ;   CTRL+SHIFT+r     + means SHIFT
Send, tedL1234
Send, {Tab}
Send, Ted324opt
Send, {Enter}

^+x::   ;   CTRL+SHIFT+x   + means SHIFT
Send, janetL  
Send, {Tab}
Send, Kwat623jan
Send, {Enter}
[Mod edit: [code][/code] tags fixed; topic moved to 'Ask For Help', since it's about AHK v1.1, not v2]
User avatar
Posts: 4783
Joined: 27 Feb 2014, 12:30

Re: AHK works sporatically

14 Aug 2019, 06:45

If an application only sees keys send by the script intermittently, Delete the line SendMode, Input and add the line SetKeyDelay, 0, 50 in it's place.
The problem is that the game is polling for key state (Likely once every 50ms or so) and when it does not work, what is happening is that AHK is pressing and releasing the key between on poll and the next, so the game sees nothing. Using the SetKeyDelay command ensures all keys are held for 50ms, so the press will always be in one poll, and the release in the next

Return to “Ask For Help”

Who is online

Users browsing this forum: _______E_______, aurafyyy, Bing [Bot], blured, boiler, sobuj53 and 56 guests