-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInc_KillingArt.ahk
97 lines (82 loc) · 1.78 KB
/
Inc_KillingArt.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
94
95
96
97
;Killing Art Include File
;Inc_KillingArt.ahk
;By: Chdata
;6/27/2015
#SingleInstance, Force
#NoEnv
SendMode Input
;Degrees to radians
;(pi/180)
dtr := 0.01745329252
;pi
pi := 3.14159265
;tau (2pi)
tau := 6.2831853
Sgn(Val) ; Returns the sign of the value
{
Return, x < 0 ? -1 : x > 0 ? 1 : 0
}
aRoot(Val) ; Square root the absolute value of a number to avoid complex numbers, but multiply the result by its sign.
{
Return Sgn(Val)*Sqrt(Abs(Val))
}
;Abs(Val)
;{
; Return Sgn(Val)*Val
;}
Csc(Theta)
{
Return 1/Sin(Theta)
}
Sec(Theta)
{
Return 1/Cos(Theta)
}
Cot(Theta)
{
Return 1/Tan(Theta)
}
GetClass()
{
MouseGetPos,,, Window
WinGetClass, Class, ahk_id %Window%
return Class
}
; http://www.autohotkey.com/forum/viewtopic.php?p=341120#341120
; http://www.autohotkey.com/board/topic/98662-get-window-under-a-certain-xy-position
WinGetAtCoords(x,y,what="Class")
{ ; by SKAN and Learning one
; Returns Title/ID/Class/PID of window at given coordinates
WinID := DllCall( "GetAncestor", UInt ; by SKAN
,DllCall( "WindowFromPoint", Int,X, Int,Y )
, UInt, GA_ROOT := 2)
if (what = "Title" or what = "T") {
WinGetTitle, WinTitle, ahk_id %WinID%
Return WinTitle
}
else if (what = "ID" or what = "I")
Return WinID
else if (what = "Class" or what = "C") {
WinGetClass, WinClass, ahk_id %WinID%
Return WinClass
}
else if (what = "PID" or what = "P") {
WinGet, WinPID, PID, ahk_id %WinID%
Return WinPID
}
}
TryReload()
{
IfExist, %A_ScriptFullPath%
Reload
Else
ExitApp
}
PreventDesktopUsage()
{
Class := GetClass()
If (Class == "Progman" || Class == "WorkerW" || Class == "CabinetWClass")
{
TryReload()
}
}