Skip to content

Commit 34772a3

Browse files
committed
Compile icons into executables. Closes #1.
1 parent dc0e9e3 commit 34772a3

File tree

10 files changed

+32
-56
lines changed

10 files changed

+32
-56
lines changed

CapslockNumpad.exe

-1.07 MB
Binary file not shown.

Capslock_Numpad.ahk

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,32 @@ SetWorkingDir %A_ScriptDir%
2929
SetNumLockState, On
3030
Suspend, On
3131

32+
numlock_on()
33+
{
34+
return GetKeyState("NumLock", "T")
35+
}
36+
37+
update_traytip()
38+
{
39+
tray_text := "CapsLock Numpad`nToggle with Ctrl + CapsLock"
40+
41+
if (numlock_on() == true) {
42+
numlock_state := "NumLock is ON"
43+
} else {
44+
numlock_state := "NumLock is OFF"
45+
}
46+
47+
Menu, Tray, Tip, %tray_text%`n`n%numlock_state%
48+
}
49+
50+
update_traytip()
3251

3352
; - Ctrl + CapsLock toggling ---------------------------------
3453

3554
^CapsLock::
3655
Suspend, Toggle
3756
SoundPlay, *48
57+
update_traytip()
3858
Return
3959

4060

@@ -54,11 +74,12 @@ SC034::NumpadDot ; Period/Greater-Than key
5474
SC02B:: ; Backslash/Pipe
5575
Send {NumLock}
5676
SoundPlay, *64
77+
update_traytip()
5778
Return
5879

5980

6081

61-
#If (GetKeyState("NumLock", "T") == true)
82+
#If (numlock_on() == true)
6283
7::Numpad7
6384
8::Numpad8
6485
9::Numpad9
@@ -71,7 +92,7 @@ SC02B:: ; Backslash/Pipe
7192
l::Numpad3
7293

7394

74-
#If (GetKeyState("NumLock", "T") == false)
95+
#If (numlock_on() == false)
7596
7::NumpadHome
7697
8::NumpadUp
7798
9::NumpadPgUp

Capslock_Numpad.exe

1.07 MB
Binary file not shown.

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# CapslockNumpad 1.1.0 (2019-12-30)
22

33
- Internal change from using stored program state to using AHK's suspend/unsuspend system, which allows me to use icons that are stored inside the executable. Closes [#1](https://github.com/DesiQuintans/CapslockNumpad/issues/1).
4+
- Add informative hover tooltip to tray icon.
5+
- Change tray icons.
6+
- Rebind 'm' to also act as NumPad Zero.
47

58

69

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ An Autohotkey script for Windows that lets you emulate a numeric keypad (numpad)
66

77
## Operation
88

9-
Extract `CapslockNumpad.exe`, `numpad_red.ico`, and `numpad_green.ico` to anywhere on your computer. Run `CapslockNumpad.exe`. The executable does not write anything to your computer.
9+
Extract `CapslockNumpad.exe` to anywhere on your computer and run it. The executable does not write anything to your computer.
1010

1111
Press `Ctrl + CapsLock` to toggle the numpad on and off. Press `\` (above the `Enter` key) to toggle NumLock.
1212

13-
The source code is in the `/src/` directory of this repo if you want to edit the script.
13+
The source code is in `CapsLock_Numpad.ahk` if you want to edit the script, but it will not have the nice icons.
1414

1515
![Key layout diagram](images/keyboard_layout.png)
1616

17-
The tray icon for CapslockNumpad changes colour to indicate the state of the numpad (red for disabled, green for enabled). I recommend setting this icon to always be visible in the tray (in Windows 10: Right-click the taskbar → Taskbar settings → Notification area → Select with icons appear on the taskbar).
17+
The tray icon for CapslockNumpad changes colour to indicate the state of the numpad (grey for disabled, blue for enabled). I recommend setting this icon to always be visible in the tray (in Windows 10: Right-click the taskbar → Taskbar settings → Notification area → Select with icons appear on the taskbar). The state of NumLock is in the hover tooltip of the tray icon.
1818

1919

2020

2121
## Acknowledgements
2222

23-
- Numpad tray icon by Kirby Wu from the Noun Project <https://thenounproject.com/search/?q=numpad&i=686166>
2423
- Keyboard layout diagram from <http://www.keyboard-layout-editor.com>
2524
- Base code from [/u/GroggyOtter](https://www.reddit.com/r/AutoHotkey/comments/abyg9b/help_script_for_emulated_numpad_function/)

compile.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
@REM The TIMEOUTs make time for the executable to be compiled and edited at each step.
22
@REM Without them, some icons might not be overwritten properly.
33

4-
"C:\Dropbox\Autohotkey\Ahk2Exe_L\Ahk2Exe.exe" /in "Capslock_Numpad.ahk" /icon "icons\numpad_green.ico"
4+
"C:\Dropbox\Autohotkey\Ahk2Exe\Ahk2Exe.exe" /in "Capslock_Numpad.ahk" /icon "icons\enabled.ico"
55
@TIMEOUT 5
66

77
@REM Main program icon.
8-
"C:\Dropbox\Apps\ResHacker\ResourceHacker.exe" -open Capslock_Numpad.exe -save Capslock_Numpad.exe -action addoverwrite -resource "icons\numpad_green.ico" -mask ICONGROUP,159,
8+
"C:\Dropbox\Apps\ResHacker\ResourceHacker.exe" -open Capslock_Numpad.exe -save Capslock_Numpad.exe -action addoverwrite -resource "icons\enabled.ico" -mask ICONGROUP,159,
99
@TIMEOUT 1
1010

1111

1212
@REM 'Suspend' icon.
13-
"C:\Dropbox\Apps\ResHacker\ResourceHacker.exe" -open Capslock_Numpad.exe -save Capslock_Numpad.exe -action addoverwrite -resource "icons\numpad_red.ico" -mask ICONGROUP,206,
13+
"C:\Dropbox\Apps\ResHacker\ResourceHacker.exe" -open Capslock_Numpad.exe -save Capslock_Numpad.exe -action addoverwrite -resource "icons\disabled.ico" -mask ICONGROUP,206,
1414
@TIMEOUT 1
1515

1616

icons/noun_numpad_686166.svg

Lines changed: 0 additions & 47 deletions
This file was deleted.

icons/numpad_green.ico

-50.1 KB
Binary file not shown.

icons/numpad_red.ico

-50.1 KB
Binary file not shown.

images/keyboard_layout.png

-13.9 KB
Loading

0 commit comments

Comments
 (0)