hey, is it possible to connect the gui to the game window from the left side of the window right after i open script? I tried many times, but I only managed to put it on the window, I would like to connect from the side and not directly on the game window. Here example down below
[Mod action: Moved topic to the “Gaming” section. Please post in the correct section.]
Help/ is it possible?
Re: Help/ is it possible?
Code: Select all
; This script shows a GUI adjacent to a target window.
#Requires AutoHotkey v1.1.33
game := "ahk_exe notepad.exe"
guiWidth := 120
offsetX := 10
offsetH := -8
Gui +AlwaysOnTop +HwndhWnd
Gui Font, s10
Gui Add, Text, w100, Test
If WinExist(game) {
WinActivate
WinGetPos x, y,, height
Gui Show, % "NA x" Max(0, x - guiWidth + offsetX) "y" y
WinMove % "ahk_id" hWnd,,,, guiWidth, height + offsetH
}
1. The width option of Gui, Show, not used here, indicates the width of the window's client area, which excludes the window's borders.
2. DPI scaling is enabled by default. If DPI scaling is enabled, coordinates and sizes passed to or retrieved from the Gui sub-commands and related variables are automatically scaled based on screen DPI.
3. A feature of Microsoft Windows, some windows have dimensions that appear to be slightly different from dimensions of visible areas.
4. When you create a post, including a script helps the forum readers to understand the issue at hand. Create a thread subject to match! Describe the topic or problem, not your wish to get help with it. See the forum dashboard for examples.
-
- Posts: 55
- Joined: 20 Mar 2023, 12:59
Re: Help/ is it possible?
@mikeyww Hey. It works very well! Thanks! is it also possible to make script gui follow game window? Tried to make it with settimer but i can't even click anywhere because it refreshes position
Re: Help/ is it possible?
Code: Select all
; This script shows a GUI adjacent to a target window.
#Requires AutoHotkey v1.1.33
Process Priority,, B
Gui +AlwaysOnTop +HwndhWnd
Gui Font, s10
Gui Add, Text, w100, Test
Global game := "ahk_exe notepad.exe"
, gui := "ahk_id" hWnd
If WinExist(game)
WinActivate
Loop {
WinWait % game
SetTimer move, 400
move()
SoundBeep 1500
WinWaitClose
SetTimer move, Off
SoundBeep 1000
}
move() {
Static guiWidth := 120
, offsetX := 10
, offsetH := -8
, lastX := 0
, lastY := 0
, lastH := 0
, x := ""
, y := ""
, height := ""
If WinExist(game) {
lastX := x, lastY := y, lastH := height
WinGetPos x, y,, height
If (x != lastX || y != lastY || height != lastH) {
gx := Max(0, x - guiWidth + offsetX)
If !WinExist(gui)
Gui Show, % "NA x" gx "y" y
WinMove % gui,, gx, y, guiWidth, height + offsetH
SoundBeep 2000
}
}
}
-
- Posts: 55
- Joined: 20 Mar 2023, 12:59
Re: Help/ is it possible?
@mikeyww Thanks a lot for real!