aboutsummaryrefslogtreecommitdiff
path: root/scripts.ahk
blob: 45d4cbe771e3f61866054a902ae9a97a36649bd1 (plain)
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
#Include ../lib/Acc.ahk

; Directives ------------------------------------------------------------------

<<directives>>

#SingleInstance Force
#Persistent
#NoEnv
#WinActivateForce
#MaxHotkeysPerInterval 200

; Initialization --------------------------------------------------------------

WindowMessageHandlers := []

<<init>>

Gui +LastFound
DllCall("RegisterShellHookWindow", UInt, WinExist())
msg := DllCall("RegisterWindowMessage", Str, "SHELLHOOK")
OnMessage(msg, "WindowMessage")
return

; Body ------------------------------------------------------------------------

<<body>>

; Miscellaneous

#Space::CapsLock
#PrintScreen::Media_Prev
#ScrollLock::Media_Play_Pause
#Pause::Media_Next

#e::Run, % "explorer /n, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
#!t::WinSet, AlwaysOnTop,, ahk_class tooltips_class32 ; fix bug

; Set default web browser

#^d::
Run, reg import "%A_ScriptDir%\chrome.reg",, Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
return

#!d::
Run, reg import "%A_ScriptDir%\mypal.reg",, Hide
DllCall("Shell32\SHChangeNotify", UInt, 0x08000000, UInt, 0, UIntP, 0, UIntP, 0)
return

; Enable/disable proxy server

#^p::Run, toggleproxy 1,, Hide
#!p::Run, toggleproxy 0,, Hide

; Sleep

^+F12 Up::
Sleep, 600
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
return

+F12 Up::
Sleep, 600
SendMessage,0x112,0xF170,2,,Program Manager ; turn off monitor
return

^F12 Up::
Sleep, 600
Run, %A_WinDir%\system32\ssstars.scr /s ; start screen saver
return

; Library ---------------------------------------------------------------------

<<library>>

WindowMessage(wParam, lParam)
{
	global WindowMessageHandlers
	for k, v in WindowMessageHandlers
	{
		%v%(wParam, lParam)
	}
}