Advertisement
Maygi

[ALL Monitor Sizes] Path of Exile: GAME RESIZER - More Field of View! [AutoHotkey Script]

Feb 7th, 2024 (edited)
3,183
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Script by Mikey and ChatGPT. My Discord is .maygi if you require assistance.
  2.  
  3. #Persistent
  4.  
  5. SetTitleMatchMode, 2 ; Allow for partial title matches
  6.  
  7. F10::
  8.     If (WinActive("Path of Exile")) {
  9.         ToggleAspectRatio("Path of Exile")
  10.     }
  11.     return
  12.  
  13. ToggleAspectRatio(title) {
  14.     ; Check the current aspect ratio state
  15.     currentRatio := GetAspectRatio(title)
  16.    
  17.     ; Determine the target aspect ratio
  18.     targetRatio := (currentRatio = 16 / 9) ? 16 / 7 : 16 / 9
  19.    
  20.     ; Calculate new window height while maintaining the aspect ratio
  21.     newHeight := A_ScreenWidth / targetRatio
  22.    
  23.     ; Get the current window position
  24.     WinGetPos, currentX, currentY, currentWidth, currentHeight, %title%
  25.    
  26.     ; Calculate the new window position
  27.     newY := currentY + (currentHeight - newHeight) // 2
  28.    
  29.     ; Set the new window position and size using DllCall
  30.     DllCall("SetWindowPos", "UInt", WinExist(title), "Int", 0, "Int", currentX, "Int", newY, "Int", currentWidth, "Int", newHeight, "UInt", 0x04 | 0x02)
  31.    
  32.     ; Set the window as always on top
  33.     WinSet, AlwaysOnTop, % (targetRatio = 16 / 7) ? "On" : "Off", %title%
  34.    
  35.     ; Bring the window to the front if the aspect ratio is 16/7
  36.     if (targetRatio = 16 / 7) {
  37.         WinActivate, ahk_id %title%
  38.     }
  39. }
  40.  
  41. GetAspectRatio(title) {
  42.     ; Get the aspect ratio of the window
  43.     WinGetPos, , , currentWidth, currentHeight, %title%
  44.     return currentWidth / currentHeight
  45. }
  46.  
Advertisement
Comments
  • Maygi
    1 year
    # text 0.58 KB | 0 0
    1. *** One Time Setup ***
    2. 1) Download AutoHotkey https://www.autohotkey.com/
    3. 2) Create a new text document and open it.
    4. 3) Copy/paste my script into it, press CTRL + SHIFT + S and name it 'widescreen.ahk', click "Save."
    5. You can now freely run the script whenever, hit F10 to toggle between widescreen mode and normal mode. *May change keybind on line 7.
    6.  
    7. *The screen stays on top when in widescreen mode so you can utilize the space underneath without hiding your game.
    8. You can remove if desired by deleting line 33. Only works for POE, so don't worry about messing up your other programs! =)
Add Comment
Please, Sign In to add comment
Advertisement