0
votes

I'm using an AHK script which lets me map the number row of my laptop keyboard to the numpad, so that I can type the ALT-Codes. I have mapped it so that it is suspended/unsuspended with a special key combo: ^SC11E (SC11E) being the ASCII code of a key on my Dell keyboard.

But, this creates a problem that when AHK first loads the script, the mapping is already done, thus I can't type the special characters like !@#$%^&*() without first Suspending the script.

Is there a way to load a script in the suspended state, or suspend a script just after loading.

This is my script:

; Remap Numpad
; https://www.youtube.com/watch?v=ErNQz5PC73c
; NumPad-CODE
; remapping "normal" number keys to make them
; behave like numpad numbers
0::Numpad0
1::Numpad1
2::Numpad2
3::Numpad3
4::Numpad4
5::Numpad5
6::Numpad6
7::Numpad7
8::Numpad8
9::Numpad9
;using the "Ctrl + Toggle Mousepad" to turn on/off remapping code
^SC11E::
Suspend,Toggle
return

What I've tried so far is manually sending the !SC11E combo at the end of the script like so:

...  ;code from previous snippet
return
Send ^{SC11E}  ;Try to suspend the script - 1st try
Send ^SC11E  ; Try to suspend the script - 2nd try
Suspend  ;Try to suspend the script - 3rd try

But none of these approaches work... How do I do this?

1

1 Answers

1
votes

As per the documention:

Any hotkey/hotstring subroutine whose very first line is Suspend (except Suspend On) will be exempt from suspension. In other words, the hotkey will remain enabled even while suspension is ON. This allows suspension to be turned off via such a hotkey.

suspend ; suspend hotkeys at start

0::Numpad0
1::Numpad1
2::Numpad2
3::Numpad3
4::Numpad4
5::Numpad5
6::Numpad6
7::Numpad7
8::Numpad8
9::Numpad9

SC11E::suspend