Note that there are some explanatory texts on larger screens.

plurals
  1. POAutoHotKey macro - difficulty with window focus
    primarykey
    data
    text
    <p>PREVIOUS QUESTION: I'm playing an online flash game that is basically Hangman. The only way to input letters is by clicking on them on the on-screen keyboard in the game. I'd like to write some sort of macro that would map keyboard presses with mouse locations, so that I could type the letters on my keyboard and have the mouse go click on the corresponding on-screen keyboard letters. I'm running Windows 7 on a Dell laptop. Is there any way to do this? Any programs that would help with this? I have some experience programming in Java if that helps. </p> <p>UPDATE: I'm using AutoHotKey to write the macro. Here is what I have:</p> <pre><code>#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. LAlt &amp; a:: IfWinExist Bearville - Mozilla Firefox { WinActivate } DllCall("mouse_event", "UInt", 0x01, "UInt", 460, "UInt", 560) ; move DllCall("mouse_event", "UInt", 0x02) ; left button down DllCall("mouse_event", "UInt", 0x04) ; left button up sleep 250 DllCall("mouse_event", "UInt", 0x01, "UInt", -460, "UInt", -560) ; move return LAlt &amp; b:: IfWinExist Bearville - Mozilla Firefox { WinActivate } DllCall("mouse_event", "UInt", 0x01, "UInt", 500, "UInt", 560) ; move DllCall("mouse_event", "UInt", 0x02) ; left button down DllCall("mouse_event", "UInt", 0x04) ; left button up sleep 250 DllCall("mouse_event", "UInt", 0x01, "UInt", -500, "UInt", -560) ; move return </code></pre> <p>and so on. If the window is not active, activate it. Move the pointer from the upper left corner to the location of the letter on the screen, left mouse button down and up, wait 250 milliseconds (because having no delay resulted in the click not registering) and then move the pointer back to the starting location. This works for one letter, but if I try to enter another letter right afterwards, the window loses focus as soon as I press the left alt key. Finishing entering the hotkey makes the window activate but the pointer does not seem to move or click, and the window loses focus again. How can I fix it?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload