-
Notifications
You must be signed in to change notification settings - Fork 0
/
solitaire.ahk
93 lines (73 loc) · 1.67 KB
/
solitaire.ahk
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#Persistent
#SingleInstance, force
;#MaxHotkeysPerInterval 200
SendMode Event
SetWorkingDir, %A_ScriptDir%
SleepTime := 10
SetWinDelay, 0
SetTitleMatchMode, 3
;SetTitleMatchMode, slow
DetectHiddenWindows, On
; uncomment this if script keys are noticeably slower than normal
;Process, Priority, , High
; you shouldn't need to change anything below here
global AppId := 0
global GameName := "Solitaire"
global WindowTitle := "Solitaire"
; import the shared script functions after we declared the AppId and GameName
#Include, scripts/ahk_shared.ahk
Try
{
RemoveStandardMenuItems()
AddGameTrayMenuItems()
AddToolMenuItems()
}
Finally
{
AddStandardTrayMenuItems()
ShowNotification(GameName)
}
WinGetActiveTitle() {
WinGetActiveTitle, v
Return, v
}
return
#IfWinNotActive Solitaire
f3::
if InStr(WinGetActiveTitle(), "New Game")
{
MsgBox, "No."
}
if WinGetActiveTitle() contains Lost,Won
{
MsgBox, "Game won/lost."
}
return
f4::
MsgBox % "The active window's ID is " WinExist("A")
return
f5::
WinGetActiveTitle, h_title
MsgBox, The active window is "%h_title%".
return
f6::
WinGetClass, h_class, A
MsgBox, The active window class is "%h_class%".
return
f7::
ControlGetFocus, ActiveCtrl, A
MsgBox, The current active Control is "%ActiveCtrl%".
return
#IfWinActive Solitaire
f3::
Sleep 0
Send {h down}
Send {h up}
;Sleep 5
Sleep 0
Send {Enter down}
Send {Enter up}
Sleep 0
return
#IfWinActive
^+r::Reload ; {Ctrl + Shift + r} reloads the current script