The things I'm known for =D
Well, I put something together that should work for you. Download the attached ahk file or paste the below code into a text file saved with the .ahk extension. Either way, run the file with
AutoHotkey installed. It'll sit in your taskbar as a green H icon. To use it, use the 1, 2 and 3 keys to toggle the hold effect on and off for Shift, Z and C respectively. (C, obviously, only for GFW). The hold effect starts OFF, so don't turn it on until you're in the game, or using the menus will be awkward. Once on, tap the game keys once to lock them on/off. You can edit the script where the numbers 1 2 or 3 are, if you want to use keys other than 1 2 3 to toggle.
I'll also attach a compiled exe version if you want it portable or don't wanna install AutoHotkey. Of course, with a compiled version you can't edit anything, and your antivirus will probably go "We don't recognize this program!!!" because I just created it. (Even my own did, so). But if you allow it it'll work just the same.
#NoEnv ;Touhou key toggles by Goldom
#Warn
#Warn UseUnsetGlobal, off
GroupAdd Touhou, ahk_class BASE
GroupAdd Touhou, ahk_class NP2-MainWindow
GroupAdd Touhou, ahk_class zwxwnd
GroupAdd Touhou, ahk_class T98-Next
Hotkey $LShift, shiftswitch, off
Hotkey $z, zswitch, off
Hotkey $c, cswitch, off
#IfWinActive ahk_group Touhou
1::
Hotkey $LShift, toggle
SendInput {LShift up}
shiftvar := 0
Return
2::
Hotkey $z, toggle
SendInput {z up}
zvar := 0
Return
3::
Hotkey $c, toggle
SendInput {c up}
cvar := 0
Return
shiftswitch:
if shiftvar
{
SendInput {LShift up}
shiftvar--
}
else
{
SendInput {LShift down}
shiftvar++
}
Return
zswitch:
if zvar
{
SendInput {z up}
zvar--
}
else
{
SendInput {z down}
zvar++
}
Return
cswitch:
if cvar
{
SendInput {c up}
cvar--
}
else
{
SendInput {c down}
cvar++
}
Return
Side note: I figured out why I was having so much trouble with my other script while working on this one. For some reason, AHK can't see keys you press in TD, even though it's set to watch all windows. All other Touhous work just fine. But for TD you have to specifically tell it to watch TD, or it misses it. No idea why. But since all Windows Touhou games use ahk_class BASE, that's no big deal once I figured it out. The above code also includes the ahk_class IDs for all three PC-98 emulators as well.