Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Script by Mikey and ChatGPT. My Discord is .maygi if you require assistance.
- #Persistent
- SetTitleMatchMode, 2 ; Allow for partial title matches
- F10::
- If (WinActive("Path of Exile")) {
- ToggleAspectRatio("Path of Exile")
- }
- return
- ToggleAspectRatio(title) {
- ; Check the current aspect ratio state
- currentRatio := GetAspectRatio(title)
- ; Determine the target aspect ratio
- targetRatio := (currentRatio = 16 / 9) ? 16 / 7 : 16 / 9
- ; Calculate new window height while maintaining the aspect ratio
- newHeight := A_ScreenWidth / targetRatio
- ; Get the current window position
- WinGetPos, currentX, currentY, currentWidth, currentHeight, %title%
- ; Calculate the new window position
- newY := currentY + (currentHeight - newHeight) // 2
- ; Set the new window position and size using DllCall
- DllCall("SetWindowPos", "UInt", WinExist(title), "Int", 0, "Int", currentX, "Int", newY, "Int", currentWidth, "Int", newHeight, "UInt", 0x04 | 0x02)
- ; Set the window as always on top
- WinSet, AlwaysOnTop, % (targetRatio = 16 / 7) ? "On" : "Off", %title%
- ; Bring the window to the front if the aspect ratio is 16/7
- if (targetRatio = 16 / 7) {
- WinActivate, ahk_id %title%
- }
- }
- GetAspectRatio(title) {
- ; Get the aspect ratio of the window
- WinGetPos, , , currentWidth, currentHeight, %title%
- return currentWidth / currentHeight
- }
Advertisement
Comments
-
- *** One Time Setup ***
- 1) Download AutoHotkey https://www.autohotkey.com/
- 2) Create a new text document and open it.
- 3) Copy/paste my script into it, press CTRL + SHIFT + S and name it 'widescreen.ahk', click "Save."
- You can now freely run the script whenever, hit F10 to toggle between widescreen mode and normal mode. *May change keybind on line 7.
- *The screen stays on top when in widescreen mode so you can utilize the space underneath without hiding your game.
- 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