
Quote from Talker on October 17, 2021, 9:39 pmI am experimenting with a simple utility to launch both Notepad and Wordpad with a global hotkey and I'm getting the following almost continuously:
"Unable to add Hotkey()"
However, after clicking OK the hotkey appears to be functional in most cases...
I'm getting the message if I minimize the app (tray icon) and then restore it again, if I try to close the app by right clicking the tray icon. But sometimes also if another application is launched (which then takes the focus).
An Occasionally after trying to set a new hotkey, I'm getting "No such hot key". Then after setting a new one it seems to work again.
I take it I can add a second or third application to this utility? I added the variable for Wordpad but that does not seem to work.
I attached the app.
I am experimenting with a simple utility to launch both Notepad and Wordpad with a global hotkey and I'm getting the following almost continuously:
"Unable to add Hotkey()"
However, after clicking OK the hotkey appears to be functional in most cases...
I'm getting the message if I minimize the app (tray icon) and then restore it again, if I try to close the app by right clicking the tray icon. But sometimes also if another application is launched (which then takes the focus).
An Occasionally after trying to set a new hotkey, I'm getting "No such hot key". Then after setting a new one it seems to work again.
I take it I can add a second or third application to this utility? I added the variable for Wordpad but that does not seem to work.
I attached the app.
Uploaded files:
Quote from Vadim on October 18, 2021, 9:45 pm@talker
I think you have unnecessary commands on the Activation tab (in the project properties). Try my simplified demo file, based on your project. Everything works fine.
I think you have unnecessary commands on the Activation tab (in the project properties). Try my simplified demo file, based on your project. Everything works fine.
Uploaded files:
Quote from Talker on October 19, 2021, 1:59 amThanks Vadim.
It works fine now during one session. But when the app is closed the hotkeys are not being stored.
In the initial version the following was in startup:
ShowErrors "False"
RegistryRead "HKEY_CURRENT_USER" "Software\[PubTitle]\Modifier" "[Modifier]"
If "[Modifier]" "=" ""
SetVar "[Modifier]" "Alt"
EndIf
RegistryRead "HKEY_CURRENT_USER" "Software\[PubTitle]\Letter" "[Letter]"
If "[Letter]" "=" ""
SetVar "[Letter]" "N"
EndIf
ShowErrors "False".assign the hot key (requires NeoBookKB plug-in)
SetVar "[HotKey]" "[Modifier]+[Letter]"
kbAddHotKey "[HotKey]" "notepad"
Endif
ShowErrors "False"
SetVar "[InitOK]" "True"Apart from the obvious glitches this caused (and it would reset the hotkey to Alt+n upon initial launch) it did save the setting after that. For the notepad entry at least.
Any ideas how to make your version save as well?
Thanks Vadim.
It works fine now during one session. But when the app is closed the hotkeys are not being stored.
In the initial version the following was in startup:
ShowErrors "False"
RegistryRead "HKEY_CURRENT_USER" "Software\[PubTitle]\Modifier" "[Modifier]"
If "[Modifier]" "=" ""
SetVar "[Modifier]" "Alt"
EndIf
RegistryRead "HKEY_CURRENT_USER" "Software\[PubTitle]\Letter" "[Letter]"
If "[Letter]" "=" ""
SetVar "[Letter]" "N"
EndIf
ShowErrors "False"
.assign the hot key (requires NeoBookKB plug-in)
SetVar "[HotKey]" "[Modifier]+[Letter]"
kbAddHotKey "[HotKey]" "notepad"
Endif
ShowErrors "False"
SetVar "[InitOK]" "True"
Apart from the obvious glitches this caused (and it would reset the hotkey to Alt+n upon initial launch) it did save the setting after that. For the notepad entry at least.
Any ideas how to make your version save as well?

Quote from Vadim on October 19, 2021, 10:55 pm@talker
Yes, of course you can store keyboard shortcuts in the registry, I do that too. As for the above code:
1) There is no sense in repeating the ShowErrors "False" command in one script several times because it is valid until it is cancelled by the ShowErrors "True" command.
2) There is an extra EndIf, but it's not essential.
I have written a little extra code to make the project save hotkeys to your two favorite applications. Keep in mind that you are creating global hotkeys. This means that if you make Ctrl+C to call Notepad, you will not be able to copy text with this combination (Notepad will appear every time). That is, for the functions of your application, it is better to choose other, less used keyboard shortcuts.
Yes, of course you can store keyboard shortcuts in the registry, I do that too. As for the above code:
1) There is no sense in repeating the ShowErrors "False" command in one script several times because it is valid until it is cancelled by the ShowErrors "True" command.
2) There is an extra EndIf, but it's not essential.
I have written a little extra code to make the project save hotkeys to your two favorite applications. Keep in mind that you are creating global hotkeys. This means that if you make Ctrl+C to call Notepad, you will not be able to copy text with this combination (Notepad will appear every time). That is, for the functions of your application, it is better to choose other, less used keyboard shortcuts.
