Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

AutoHotkey

From PCGamingWiki, the wiki about fixing PC games
This page is a stub: it lacks content and/or basic article components. You can help to expand this page by adding an image or additional information.
AutoHotkey
AutoHotkey cover
Developers
Chris Mallett
Steve
Release dates
Windows November 10, 2003

Key points

Scripting language for writing mouse and keyboard macros. Very useful at creating hotkeys or rebinding mouse/keyboard controls when the game for whatever reason doesn't allow you to.
Games utilizing PunkBuster as an anti-cheat measure may mistakenly treat AutoHotkey as a cheat.

General information

Official Website, GitHub and Discord
New Forums (Bulletin Board) and Archived Forums (IP.Board)

Installation

Saving and running AutoHotkey scripts
  1. Download Autohotkey v2 and install it.
  2. Go to the Desktop, then Right Click on an empty space and select New, AutoHotkey script.
  3. Right Click on the AutoHotkey file, and select Edit Script, erase the contents of this file, close it and save any new changes.
  4. Double click on the file in order to launch the script.

Notes

AutoHotkey scripts can be placed in the Startup folder of Windows in order to be executed automatically.
Autohotkey v1 could be needed when trying to run older code.

Video

Borderless fullscreen windowed

Fullscreen toggle script

This script will remove any borders and center the currently active window on the primary monitor by pushing F12.
Instructions
  1. Download AutoHotkey and install it.
  2. Go to the Desktop, then Right Click on an empty space and select New, AutoHotkey script.
  3. Right Click on the AutoHotkey file, and select Edit Script, erase the contents of the file.
  4. Copy the following source code into the new file:
    For Autohotkey 1.x
    #UseHook On
    F12::
    
    WinGet, WindowID, ID, A
    WinSet, Style, ^0xC40000, ahk_id %WindowID%
    WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight
    
    Return
    

    For Autohotkey 2.x

    F12::{
    
        WindowID := WinGetID("A")
        WinSetStyle("^0xC40000", WinID) ; Toggles the flag with ^       
        WinMove(0, 0, A_ScreenWidth, A_ScreenHeight, WinID)
    
    }
    
  5. Save and close the file.
  6. Double Click on the file to execute the script.
  7. Push F12 while in a game in order to activate the script.

Fullscreen toggle script (hidden taskbar)

This script will toggle between fullscreen and windowed modes when pressing F12 as well as hiding the taskbar on the fullscreen mode.
Follow the instructions of fullscreen toggle script, but use the below script instead:
#UseHook On
F12::
WinGet, TempWindowID, ID, A
If (WindowID != TempWindowID)
{
  WindowID:=TempWindowID
  WindowState:=0
}
If (WindowState != 1)
{
  WinGetPos, WinPosX, WinPosY, WindowWidth, WindowHeight, ahk_id %WindowID%
  WinSet, Style, -0xC40000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight
  ;Hide Windows Task Bar and Start Button. (Remove the following two lines if you don't want that behaviour)
  WinHide ahk_class Shell_TrayWnd
  WinHide Start ahk_class Button
}
Else
{
  WinSet, Style, +0xC40000, ahk_id %WindowID%
  WinMove, ahk_id %WindowID%, , WinPosX, WinPosY, WindowWidth, WindowHeight
  ;Show the task bar again
  WinShow ahk_class Shell_TrayWnd
  WinShow Start ahk_class Button
}
WindowState:=!WindowState
return

Multiple monitors script

Someone needs to check whenever this explanation for the script is correct or if 0, 0, and A_ScreenWidth/Height mean that the script automatically detects the user's resolution.
This is a snippet from the fullscreen toggle script.
Fullscreen script
  • The values 0, 0, represent the coordinates of the upper left corner of the window.
WinMove, ahk_id %WindowID%, , 0, 0, A_ScreenWidth, A_ScreenHeight
  • For multiple resolutions the values have to be the sum of the monitors total width, for 3840x1080 them being.
WinMove, ahk_id %WindowID%, , 1920, 0, 1920, 1080

Notes

Use 1920, 0, 1920, 1080 (right) or 0, 1920, 1920, 1080 (left) in order to change which side of the screen is filled.


References