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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
SetWorkingDir, C:\Users\swhitton
; original source: http://lifehacker.com/5468862/create-a-shortcut-key-for-restoring-a-specific-window
; but I've added TheExe parameter
ToggleWinMinimize(TheWindowTitle, TheExe)
{
; If VirtuaWin is running, switch to top-left desktop before raising
; or starting. Assumes VirtuaWin's desktop wrapping is turned off!
Process, Exist, VirtuaWin.exe
VirtuaWinPID = %ErrorLevel%
if VirtuaWinPID != 0
{
Send ^!{Up}
Send ^!{Left}
Sleep, 100
}
; main function body
SetTitleMatchMode,2
DetectHiddenWindows, Off
; IfWinActive, %TheWindowTitle%
; {
; WinMinimize, %TheWindowTitle%
; }
; Else
; {
IfWinExist, %TheWindowTitle%
{
WinGet, winid, ID, %TheWindowTitle%
DllCall("SwitchToThisWindow", "UInt", winid, "UInt", 1)
}
Else
{
Run, %TheExe%
}
; }
Return
}
; same but by class not title
ToggleWinMinimizeByClass(TheWindowClass, TheExe)
{
; If VirtuaWin is running, switch to top-left desktop before raising
; or starting. Assumes VirtuaWin's desktop wrapping is turned off!
Process, Exist, VirtuaWin.exe
VirtuaWinPID = %ErrorLevel%
if VirtuaWinPID != 0
{
Send ^!{Up}
Send ^!{Left}
Sleep, 100
}
; main function body
SetTitleMatchMode,2
DetectHiddenWindows, Off
; IfWinActive, %TheWindowTitle%
; {
; WinMinimize, %TheWindowTitle%
; }
; Else
; {
IfWinExist, ahk_class %TheWindowClass%
{
WinGet, winid, ID, ahk_class %TheWindowClass%
DllCall("SwitchToThisWindow", "UInt", winid, "UInt", 1)
}
Else
{
Run, %TheExe%
}
; }
Return
}
KillCurrent()
{
Send !{F4}
; accept the 'are you sure you want to quit' dialogue of textbook
; CDs
IfWinActive, ahk_class TPlayerForm
{
Sleep, 100
Send !y
}
}
IceMessenger()
{
CoordMode Pixel
; image file referenced in the below line should be a screenshot of
; some central pixels from the Ice Messenger tray icon
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, c:\Users\swhitton\Pictures\AHK\imtrayicon.png
CoordMode, Mouse, Screen
MouseMove, %FoundX%, %FoundY%
Click
WinWaitActive, Ice Messenger, , 2
CoordMode, Mouse, Relative
MouseMove, 130, 120
Click
MouseMove, 130, 370
Click right
Send, {Down}
}
F9::ToggleWinMinimizeByClass("Emacs", "c:\emacs\bin\runemacs.exe")
; open a new Emacs client window
#F9::Run, emacsclient -n -c
F10::ToggleWinMinimize("MINGW32", "c:\Users\swhitton\Old shortcuts\Git Bash")
F11::KillCurrent()
F12::ToggleWinMinimize("Mozilla Firefox", "Firefox")
+F9::ToggleWinMinimize("3~4", "C:\e-Book\start\TitleList.exe")
+F10::ToggleWinMinimize(" CD", "c:\Users\swhitton\Old shortcuts\grades5and6")
+F11::ToggleWinMinimize("spw@ma", "c:\Users\swhitton\Software\putty.exe -load ma")
+F12::IceMessenger()
; empty the Recycle Bin
+#r::FileRecycleEmpty, C:\
; for Emacs
Capslock::Ctrl
LCtrl::Capslock
; some British keyboard layout conventions
@::"
"::@
|