View difference between Paste ID: PdGtzqAj and wEEqpRhH
SHOW: | | - or go back to the newest paste.
1
#Requires AutoHotkey v2.0
2
#SingleInstance force
3-
SetTitleMatchMode(3)
3+
4
SH := A_ScreenHeight
5
AutoH := SH/1.35 ; 1.35 is the zoom modifiar. If you get black bars on your game's sides, put it lower start at 1.30, save & retest till satisfied
6-
Global Stretched := false
6+
;### Do not edit above unless you know what you are doing########################################
7-
Global CursorLocked := false
7+
;################################################################################################
8-
Global CursorWasLockedBeforeFocusLoss := false
8+
9-
Global CursorAutoMode := true
9+
10-
Global GameWatcherRunning := false
10+
11
12
;###Settings#####################################################################################
13
14
; Set the desired width and height for the borderless window
15
DesiredWidth := SW ; Change to desirerd Width of the gaming window, Accepted Values: Value in Pixels, SW for Same Width as monitor
16
DesiredHeight := AutoH ; Change to desirerd Hight of the gaming window, Accepted Values: Value in Pixels, SH for Same Height as monitor, AutoH for Automatic stretched windowed
17-
; Hotkey to trigger the resizing (you can change to any key you prefer)
17+
18-
; ^ = ctrl, + = shift, ! = alt more info about hotkeys can be found at https://www.autohotkey.com/docs/v1/Hotkeys.htm
18+
19-
Hotkey "^NumPad0", ToggleBoarderlessStretch
19+
20-
Hotkey "^NumPad5", ToggleAlwaysOnTop
20+
Y := 0 ; Set the desirerd Y location of the gaming window, Accepted Values: Value in Pixels 0 being all way top, (SH - DesiredHeight)/2 for automatic center
21-
Hotkey "^NumPad3", ToggleCursorLock
21+
22
; Game name, change as necessary
23
GameTitle := "Path of Exile"
24-
AutoH := SH/1.35 ; 1.35 is the default zoom modifiar. If you get black bars on your game's sides, put it lower start at 1.30, save & reload script till satisfied
24+
25
; Game path, chance as necessary
26
GamePath := "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Grinding Gear Games\Path of Exile"
27
28
;###Advanced Settings############################################################################
29
30
;You should not need to edit these.. they are incase your running on a toaster
31-
Y := 0 ; Set the desirerd Y location of the gaming window, Accepted Values: Value in Pixels 0 being all way top, (SH - DesiredHeight)/2 for automatic center, (SH - DesiredHeight) for all way at bottom
31+
32
33
; How long the script waits for game to start at maximum before giving up (Seconds)
34
WinWaitTimeout := 20
35-
GameExe := "PathOfExile.exe"
35+
36
; How long until the resolution is changed and borders removed after window is detected (Milliseconds)
37
DelayBeforeTask := 4000
38
39-
SetTimer(CheckWindowFocus, 200) ; Check window focus 5 times per second
39+
40
41
; Launchers the game
42-
ToggleAlwaysOnTop(ThisHotkey){
42+
run GamePath
43-
    ; Check if the game window is open
43+
; Check if the game window is open
44
if WinWait(GameTitle, , WinWaitTimeout){
45-
        ; Activate the game window found by WinExist
45+
46-
        WinActivate
46+
        sleep DelayBeforeTask
47
48
        ; Remove the borders and title bar
49
        ; 0xC40000 = WS_BORDER (0x800000) + WS_DLGFRAME (0x400000) + WS_SIZEBOX aka WS_THICKFRAME (0x040000)
50-
        WinSetAlwaysOnTop -1, GameTitle
50+
        WinSetStyle("-0xC40000", GameTitle)
51
52-
    else{
52+
        ; Resize the window to borderless dimensions
53-
        MsgBox "Please launch game first.", "Game not found"
53+
        WinMove X, Y, DesiredWidth, DesiredHeight, GameTitle
54
        ExitApp
55
    }
56
else{
57-
ToggleBoarderlessStretch(ThisHotkey){
57+
    MsgBox "Make sure path to game in script is accurate.", "WinWait Timed Out"
58-
    Global Stretched
58+
59-
    ; Check if the game window is open
59+
60
return
61-
        ; Activate the game window found by WinExist
61+