forked from uk-dave/SolidEdge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetLocks4SE.ahk
More file actions
82 lines (73 loc) · 2.27 KB
/
SetLocks4SE.ahk
File metadata and controls
82 lines (73 loc) · 2.27 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
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
; SetLocks4SE
; Copyright (C) 2015 David C. Merritt, david.c.merritt@siemens.com
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.
;
; ---------------------------------------------------------------------
;
; AutoHotkey script to enforce the toggling of the Caps and Num locks to
; always turn on whenever Solid Edge is the active window.
;
; ---------------------------------------------------------------------
;
; 27/10/2015 merritt initial release
;
#SingleInstance, Force
#InstallKeybdHook
#Persistent
AppName=SetLocks4SE
Menu, Tray, Icon, %A_WinDir%\System32\shell32.dll, 105
Menu, Tray, Tip, Set Caps and Num locks for Solid Edge
; set to false to not enforce locks
EnforceCapslock := true
EnforceNumLock := true
SetTimer, EnforceLocks, 500
Return
EnforceLocks:
WinGet, CurrentProcess, ProcessName, A
if (CurrentProcess == "Edge.exe")
{
if (EnforceCapslock)
{
SetCapsLockState := GetKeyState("CapsLock", "T")
IfEqual, SetCapsLockState, 0
{
SetCapsLockState, On
Tooltip, Caps Lock: On
SetTimer, RemoveToolTip, 750
}
}
if (EnforceNumLock)
{
SetNumlockState := GetKeyState("NumLock", "T")
IfEqual, SetNumlockState, 0
{
SetNumlockState, On
Tooltip, Num Lock: On
SetTimer, RemoveToolTip, 750
}
}
}
Return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
; Win + p pauses the script in case you need the locks
#p::
TrayTip, %AppName%, Lock Enforcer paused, 30, 1
Pause,,1
return
; Win + q exits
#q::ExitApp