Jump to content
Sign in to follow this  

Key press not registered by AutoIT script while in a game

Recommended Posts


Hi guys, I've made a "stop watch", trying to find out how long a sword swing action takes in a game. (The game is called "Mount & Blade").

In the script, I use the "m" key to toggle the stop watch.

It works fine in windows, but inside the game, the "m" key doesn't work. (Please note: the "m" key is not used by the game).

Is it because of the DirectX blocking the keystroke being passed to any other program besides the game? Or is it because the script is not "attached" to the game process?

How do I fix this problem?

Thanks in advance.

Here's my stop watch code:

Global $StopWatchStarted=False
Global $begin = TimerInit()

HotKeySet("m", "StopWatch")

While True

Func StopWatch()
    $StopWatchStarted = NOT $StopWatchStarted
    If $StopWatchStarted Then
        $begin = TimerInit()
        ToolTip("Stop Watch Started")
        $dif = TimerDiff($begin)
        ToolTip("Time Difference " & $dif & "ms. Stop watch now off.")

Share this post

Link to post
Share on other sites

The game is blocking it.

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post

Link to post
Share on other sites

Hi, I am having the same problem but with a slight difference.

The game is Cabal and I am already bypassing the X-Trap game control. I am able to use QMacro with hotkeys assigned to start macros but unable to start execution of AutoIt. Outside of Cabal game, it is ok.

Is there anyway to force AutoIt to catch the keystrokes first?

Thanks in advance.

Share this post

Link to post
Share on other sites

try adding in the function

send ("m")

when hotkeyset m is used autoit uses the key for itself and doesn't send it away so you send the m by the script

Share this post

Link to post
Share on other sites

If HotKeySet doesnt work _IsPressed will certainly work its the best !

Cheers, FireFox.


OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.