FirstKey can contain only ^, ! and # while Second Key can contain any letter a-z and or any number 0-9.
Code: Select all
If FirstKeyCH = ALT
{
FileRead, CheckDHK, %A_MyDocuments%\Keyboard.ahk
IfInString, CheckDHK, ShowHotkeyHelp
{
FileAppend,
(
!%SecondKeyCH%::Send %output%{Tab 3}
), %A_MyDocuments%\Keyboard.ahk
Gui, Main: Show
Gui, CH: Destroy
WinMinimize, HotKey Creator
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Sleep 100
Return
}
else
{
FileAppend,
(
%DHK%`r
!%SecondKeyCH%::Send %output%{Tab 3}`r
), %A_MyDocuments%\Keyboard.ahk
Gui, Main: Show
Gui, CH: Destroy
WinMinimize, HotKey Creator
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Sleep 100
Return
}
}
If FirstKeyCH = Windows Key
{
FileRead, CheckDHK, %A_MyDocuments%\Keyboard.ahk
IfInString, CheckDHK, ShowHotkeyHelp
{
FileAppend,
(
#%SecondKeyCH%::Send %output%{Tab 3}
), %A_MyDocuments%\Keyboard.ahk
WinMinimize, Company/Hospital
Sleep 100
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Reload
Return
}
else
{
FileAppend,
(
%DHK%`r
#%SecondKeyCH%::Send %output%{Tab 3}`r
), %A_MyDocuments%\Keyboard.ahk
Gui, CH: Destroy
;WinMinimize, Company/Hospital
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Reload
Return
}
}
If FirstKeyCH = CTRL
{
FileRead, CheckDHK, %A_MyDocuments%\Keyboard.ahk
IfInString, CheckDHK, ShowHotkeyHelp
{
FileAppend,
(
^%SecondKeyCH%::Send %output%{Tab 3}
), %A_MyDocuments%\Keyboard.ahk
WinMinimize, Company/Hospital
Sleep 100
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Reload
Return
}
else
{
FileAppend,
(
%DHK%`r
^%SecondKeyCH%::Send %output%{Tab 3}`r
), %A_MyDocuments%\Keyboard.ahk
WinMinimize, Company/Hospital
Sleep 100
MsgBox, 64, Attention, Please double click on the file, "Keyboard" after the window opens.
Run, %A_MyDocuments%
Reload
Return
}
}
Return
I know I have A LOT of redundant code as I don't know how to not get the function I need without using it.