-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwindowObject.ahk
More file actions
53 lines (48 loc) · 1.1 KB
/
windowObject.ahk
File metadata and controls
53 lines (48 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class WindowObjectClass
{
__new(stringThatWillWorkWithWinExist)
{
this.hwnd := WinExist(stringThatWillWorkWithWinExist)
this.friendlyHwnd := "ahk_id " this.hwnd
this._populateStats()
return this
}
stillExists()
{
return winExist(this.friendlyHwnd)
}
restorePosition()
{
return this.move(this.x, this.y, this.width, this.height)
}
move(x, y, width, height)
{
WinMove, % this.friendlyHwnd, , % x, % y, % width, % height
return this
}
_populateStats()
{
if(! this.stillExists())
{
return false
}
WinGetPos, x, y, width, height, % this.friendlyHwnd
WinGetText, text, % this.friendlyHwnd
WinGetTitle, title, % this.friendlyHwnd
WinGetClass, class, % this.friendlyHwnd
WinGet, processId, PID, % this.friendlyHwnd
WinGet, processName, ProcessName, % this.friendlyHwnd
WinGet, minMaxState, MinMax, % this.friendlyHwnd
this.class := class
this.x := x
this.y := y
this.width := width
this.height := height
this.text := Text
this.title := title
this.processId := processId
this.processName := ProcessName
this.minMaxState := MinMax
return this
}
}