Convert user shortcuts to autohotkey hotkeys reliably and Vice versa
Like convert (Ctrl + Alt + p) to (^!p) and Vice versa
Recommended - Just see examples to see what it can do.
The best use can be in ini's OR custom Hotkey edit control that eliminates limitations of the limited ahk hotkey control
- The function handles spelling errors from users and tries to return the correct ahk hotkey for the corresponding shortcut as far as possible.
- It can differentiate between Autohotkey hotkey (^!x) and shortcuts (Ctrl+Alt+x) and returns the correct value always.
- Can convert autohotkey shortcut back to user shortcut using Hparse_rev() func
- It can manage totally invalid user shortcuts sent to it simply by eliminating the invalid part of the shortcut
- You can enable/disable [RemoveInvaild] param if you want. Enabling (default) manages invalid parts by removing them, Disabling makes the return value blank when an invalid part in shortcut is occured. This blank return can be checked and used further to perform required measures.
- If possible the returned hotkey is tried to be kept in the standard without "ampersand" (&) format. If not possible it is returned in the correct (&) format. See the EXAMPLES below for more details.
- Standard User Shortcuts are by default meant to be separated by either the plus '+' or the dash '-' . eg -- Control + Alt + S , Control - S will work.
- User shortcut(s) such as (X + Control) will be converted to (^x) and not (x^) via the [ManageOrder] Param which is enabled by default
- Shortcuts endings in modifiers are auto-detected and returned accordingly. eg -> (Control + Alt) gives ^Alt and not ^!
- No RegEx, so faster than what it should be.
- Keys are arranged a/c popularity for maximum speed of the function.
- Supports all Autohotkey keys including Joystick Keys.
Examples (in a gist) - (Please go-through)