Skip to content

Instantly share code, notes, and snippets.

@KhalidFawzy
Created November 17, 2012 09:48
Show Gist options
  • Save KhalidFawzy/4094565 to your computer and use it in GitHub Desktop.
Save KhalidFawzy/4094565 to your computer and use it in GitHub Desktop.
This is a keyboard and mouse key mapper created with AutoHotKey_L unicode 32, and has a limited support for Joystick mapping.
;############################################################################
;06/10/2012
;Ultimate KeyBinder v1.0
;Author: Khalid Fawzy
;E-Mail: [email protected]
;Created using: AutoHotKey_L Unicode 32.
;i would like to thank jaco0646 for his exellent topic about working with hotkeys located here:
;http://www.autohotkey.com/board/topic/47439-user-defined-dynamic-hotkeys/
;as a beginner it saved a lot of time for me.
;############################################################################
#Singleinstance, off
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallKeybdHook
#InstallMouseHook
#UseHook
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetStoreCapslockMode, off ;Needed to toggle Capslock on/off instead of just enabling it "it's better to be on top of script"
DropDownListItems = |0|1|2|3|4|5|6|7|8|9|Numpad0|Numpad1|Numpad2|Numpad3|Numpad4|Numpad5|Numpad6|Numpad7|Numpad8|Numpad9|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|Up|Down|Left|Right|PgUp|PgDn|Enter|Escape|Space|Tab|Backspace|Delete|Insert|Shift|LShift|RShift|Ctrl|LCtrl|RCtrl|Alt|LAlt|RAlt|LWin|RWin|CapsLock|ScrollLock|NumLock|PrintScreen|CtrlBreak|Pause|Sleep|F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12|!|#|+|^|{|}|NumpadDot|NumpadEnter|NumpadMult|NumpadDiv|NumpadAdd|NumpadSub|NumpadDel|NumpadIns|NumpadClear|NumpadUp|NumpadDown|NumpadLeft|NumpadRight|NumpadHome|NumpadEnd|NumpadPgUp|NumpadPgDn|Browser_Back|Browser_Forward|Browser_Refresh|Browser_Stop|Browser_Search|Browser_Favorites|Browser_Home|Volume_Mute|Volume_Down|Volume_Up|Media_Next|Media_Prev|Media_Stop|Media_Play_Pause|Launch_Mail|Launch_Media|WheelDown|WheelUp|WheelLeft|WheelRight|LButton|Rbutton|MButton|XButton1|XButton2|AppsKey|Joy1|Joy2|Joy3|Joy4|Joy5|Joy6|Joy7|Joy8|Joy9|Joy10|Joy11|Joy12|Joy13|Joy14|Joy15|Joy16|Joy17|Joy18|Joy19|Joy20|Joy21|Joy22|Joy23|Joy24|Joy25|Joy26|Joy27|Joy28|Joy29|Joy30|Joy31|Joy32
Hotkeys_count = 20 ; number of maximum hotkeys to create, currently 20 is supported unless you add more of these labels: lblx & lbl_HKx where x is the number of the new hotkey ie: lbl21 & lbl_HK21.
Menu, FileMenu, Add, &New profile, lblNewProfile
Menu, FileMenu, Add, &Clear current profile, lblClear
Menu, FileMenu, Add ; adding separator
Menu, FileMenu, Add, &Load profile..., lblLoad
Menu, FileMenu, Add, &Save, lblSave
Menu, FileMenu, Add, &Save as..., lblSaveAs
Menu, FileMenu, Add ; adding separator
Menu, FileMenu, Add, &Restart, lblRestart
Menu, FileMenu, Add, E&xit, GuiClose
Menu, HelpMenu, Add, &About, lblAbout
Menu, MyMenuBar, Add, &File, :FileMenu
Menu, MyMenuBar, Add, &Help, :HelpMenu
Gui, Menu, MyMenuBar
Gui, Font, S10 cRed Bold, Verdana
Gui, Add, Text, section Center , Current Profile:
Gui, Font, S10 cGreen Bold, Verdana
Gui, Add, Text, x+10 w500 Hwndid_ProfileName , -
Gui, Font, S10 cBlue Bold, Verdana
Gui, Add, Text, xs Center w240, ________Hotkey________
Gui, Add, Text, Center x+100 w350, _________Key combination_________
Gui, Add, Text, Center x+25 w260, Type(T) / Execute(E)
Gui, Font, S10 cRed Bold, Verdana
Gui, Add, Text, x+5 Center w20, Rapid
Gui, Font, ,
Progress, FM20 CWSilver B w250,, Loading..., ,
Progress, 0
Progressing = 0
Numx = 1
loop, %Hotkeys_count% {
Progressing += 6
Progress, %Progressing%
StringLen, NumLen, Numx
if (NumLen=1) {
Num := % "0" . Numx ;adding 0 to any one digit number "for rows number"
}
else {
Num = %Numx%
}
Gui, Add, Text, xm Section Center, %Num%:
Gui, Add, Checkbox, x+5 w24 vShift%A_Index% Hwndid_Shift%A_Index% glbl%A_Index%, ;Shift
Shift%A_Index%_TT := "Shift"
Gui, Add, Checkbox, x+1 w24 vCtrl%A_Index% Hwndid_Ctrl%A_Index% glbl%A_Index%, ;Ctrl
Ctrl%A_Index%_TT := "Ctrl"
Gui, Add, Checkbox, x+1 w24 vAlt%A_Index% Hwndid_Alt%A_Index% glbl%A_Index%, ;Alt
Alt%A_Index%_TT := "Alt"
Gui, Add, Checkbox, x+1 w24 vWin%A_Index% Hwndid_Win%A_Index% glbl%A_Index%, ;Win
Win%A_Index%_TT := "Windows"
Gui, Add, DropDownList, Center r30 x+10 vDDLHK%A_Index% Hwndid_DDLHK%A_Index% glbl%A_Index%, %DropDownListItems% ;r30 number of displayed rows in DropDownList
Gui, Add, Text, Center x+1 w70, Triggers :
Gui, Add, DropDownList, Center r30 x+1 vDDLKCA%A_Index% Hwndid_DDLKCA%A_Index% glblRefresh, %DropDownListItems%
Gui, Add, Text, Center x+1 w15, +
Gui, Add, DropDownList, Center r30 x+1 vDDLKCB%A_Index% Hwndid_DDLKCB%A_Index% glblRefresh, %DropDownListItems%
Gui, Add, Text, Center x+1 w15, +
Gui, Add, DropDownList, Center r30 x+1 vDDLKCC%A_Index% Hwndid_DDLKCC%A_Index% glblRefresh, %DropDownListItems%
Gui, Add, Edit, x+20 w150 vMyEdit%A_Index% Hwndid_MyEdit%A_Index% glblRefresh
Gui, Add, Radio, Checked x+10 vMyRadioA%A_Index% Hwndid_MyRadioA%A_Index% glblRefresh, T
Gui, Add, Radio, x+1 vMyRadioB%A_Index% Hwndid_MyRadioB%A_Index% glblRefresh, E
Gui, Add, Checkbox, x+40 w24 vRMode%A_Index% Hwndid_RMode%A_Index% glblRefresh,
Numx += 1
}
Progress, Off
Title1 = Ultimate KeyBinder v1.0
Title2 = Created by: Khalid Fawzy
SetTimer, AnimateTitle, 100
Gui, Color , ADD8E6
Gui +HWndGUI_ID
Gui, Show, AutoSize Center, -
;Tool Tip Code
OnMessage(0x200, "WM_MOUSEMOVE")
Return
WM_MOUSEMOVE()
{
static CurrControl, PrevControl, _TT ; _TT is kept blank for use by the ToolTip command below.
CurrControl := A_GuiControl
If (CurrControl <> PrevControl and not InStr(CurrControl, " "))
{
ToolTip ; Turn off any previous tooltip.
SetTimer, DisplayToolTip, 50
PrevControl := CurrControl
}
return
DisplayToolTip:
SetTimer, DisplayToolTip, Off
ToolTip % %CurrControl%_TT ; The leading percent sign tell it to use an expression.
SetTimer, RemoveToolTip, 3000
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
}
;==================LABELS=================
GuiEscape:
GuiClose:
ExitApp
AnimateTitle:
TextX := ""
Loop,Parse,Title1,
{
TextX = % TextX . A_LoopField
WinSetTitle, ahk_id %GUI_ID%, , %TextX%
sleep, 100
}
sleep, 700
TextX := ""
Loop,Parse,Title2,
{
TextX = % TextX . A_LoopField
WinSetTitle, ahk_id %GUI_ID%, , %TextX%
sleep, 100
}
sleep, 700
return
lbl_HK:
if (DDLKCA%X% = "" AND DDLKCB%X% = "" AND DDLKCC%X% = "" AND MyEdit%X% = "") {
Gui +OwnDialogs
MsgBox, 64, Error, Please enter a valid action!
return
}
else {
if (DDLKCA%X% != "") OR (DDLKCB%X% != "") OR (DDLKCC%X% != "") {
if (DDLKCA%X% != "") {
Send, % "{" DDLKCA%X% " down}"
}
if (DDLKCB%X% != "") {
Send, % "{" DDLKCB%X% " down}"
}
if (DDLKCC%X% != "") {
Send, % "{" DDLKCC%X% " down}"
}
KeyWait, % DDLHK%X%
if (DDLKCA%X% != "") {
Send, % "{" DDLKCA%X% " up}"
}
if (DDLKCB%X% != "") {
Send, % "{" DDLKCB%X% " up}"
}
if (DDLKCC%X% != "") {
Send, % "{" DDLKCC%X% " up}"
}
}
}
if (MyEdit%X% != "") {
if (MyRadioA%X%) {
SendInput, % MyEdit%X%
}
else {
Run, % MyEdit%X%,, UseErrorLevel
if (ErrorLevel = "ERROR") {
Gui +OwnDialogs
MsgBox, 48, Error, Can't execute this, check spelling/path!
}
KeyWait, % DDLHK%X% ;To launch the program only once
}
}
return
lbl_HK_Rapid: ;This is needed if you want the key combination to be repeated untill releasing the hotkey, this is useful with: Volume_Up, WheelDown...etc
if (DDLKCA%X% = "" AND DDLKCB%X% = "" AND DDLKCC%X% = "" AND MyEdit%X% = "") {
Gui +OwnDialogs
MsgBox, 64, Error, Please enter a valid action!
return
}
else {
if (DDLKCA%X% != "") OR if (DDLKCB%X% != "") {
if (DDLKCA%X% != "") {
SendInput, % "{" DDLKCA%X% "}"
}
if (DDLKCB%X% != "") {
SendInput, % "{" DDLKCB%X% "}"
}
if (DDLKCC%X% != "") {
SendInput, % "{" DDLKCC%X% "}"
}
}
}
if (MyEdit%X% != "") {
if (MyRadioA%X%) {
SendInput, % MyEdit%X%
}
else {
Run, % MyEdit%X%,, UseErrorLevel
if (ErrorLevel = "ERROR") {
Gui +OwnDialogs
MsgBox, 48, Error, Can't execute this, check spelling/path!
}
KeyWait, % DDLHK%X% ;To launch the program only once
}
}
return
lblCommon:
Gui, Submit, NoHide
Current_HK%X% = % (Shift%X% ? "+" : "") . (Ctrl%X% ? "^" : "") . (Alt%X% ? "!" : "") . (Win%X% ? "#" : "") . (DDLHK%X%)
tempHK = % Current_HK%X% ;copy the value of Current_HK%X% to tempHK
Current_HK%X% = ;temporarily clear Current_HK%X%
if (tempHK = Current_HK1
OR tempHK = Current_HK2
OR tempHK = Current_HK3
OR tempHK = Current_HK4
OR tempHK = Current_HK5
OR tempHK = Current_HK6
OR tempHK = Current_HK7
OR tempHK = Current_HK8
OR tempHK = Current_HK9
OR tempHK = Current_HK10
OR tempHK = Current_HK11
OR tempHK = Current_HK12
OR tempHK = Current_HK13
OR tempHK = Current_HK14
OR tempHK = Current_HK15
OR tempHK = Current_HK16
OR tempHK = Current_HK17
OR tempHK = Current_HK18
OR tempHK = Current_HK19
OR tempHK = Current_HK20
OR tempHK = Current_HK21
OR tempHK = Current_HK22
OR tempHK = Current_HK23
OR tempHK = Current_HK24
OR tempHK = Current_HK25
OR tempHK = Current_HK26
OR tempHK = Current_HK27
OR tempHK = Current_HK28
OR tempHK = Current_HK29
OR tempHK = Current_HK30) AND (tempHK != "") AND (DDLHK%X% != "") {
Gui +OwnDialogs
MsgBox,16, Error, Hotkey already assigned, choose another one.
If (Old_HK%X% != "") { ;If a hotkey was already saved...
Hotkey, % Old_HK%X%, lbl_HK%X%, Off ;turn the old hotkey off
}
GuiControl, Choose, DDLHK%X%, 1
return
}
Current_HK%X% = %tempHK% ;restore the original value of Current_HK%X%
If (Old_HK%X% != "") { ;If a hotkey was already saved...
Hotkey, % Old_HK%X%, lbl_HK%X%, Off ;turn the old hotkey off
}
If (Current_HK%X% = "") { ;If the new hotkey is blank...
Old_HK%X% = ;save the hotkey (which is now blank) for future reference.
return ;This allows an old hotkey to be disabled without enabling a new one.
}
Hotkey, % Current_HK%X%, lbl_HK%X%, On ;Turn on the new hotkey.
Old_HK%X% := Current_HK%X% ;Save the hotkey for future reference.
return
lbl1:
X = 1
goto lblCommon
return
lbl_HK1:
X = 1
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl2:
X = 2
goto lblCommon
return
lbl_HK2:
X = 2
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl3:
X = 3
goto lblCommon
return
lbl_HK3:
X = 3
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl4:
X = 4
goto lblCommon
return
lbl_HK4:
X = 4
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl5:
X = 5
goto lblCommon
return
lbl_HK5:
X = 5
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl6:
X = 6
goto lblCommon
return
lbl_HK6:
X = 6
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl7:
X = 7
goto lblCommon
return
lbl_HK7:
X = 7
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl8:
X = 8
goto lblCommon
return
lbl_HK8:
X = 8
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl9:
X = 9
goto lblCommon
return
lbl_HK9:
X = 9
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl10:
X = 10
goto lblCommon
return
lbl_HK10:
X = 10
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl11:
X = 11
goto lblCommon
return
lbl_HK11:
X = 11
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl12:
X = 12
goto lblCommon
return
lbl_HK12:
X = 12
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl13:
X = 13
goto lblCommon
return
lbl_HK13:
X = 13
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl14:
X = 14
goto lblCommon
return
lbl_HK14:
X = 14
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl15:
X = 15
goto lblCommon
return
lbl_HK15:
X = 15
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl16:
X = 16
goto lblCommon
return
lbl_HK16:
X = 16
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl17:
X = 17
goto lblCommon
return
lbl_HK17:
X = 17
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl18:
X = 18
goto lblCommon
return
lbl_HK18:
X = 18
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl19:
X = 19
goto lblCommon
return
lbl_HK19:
X = 19
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lbl20:
X = 20
goto lblCommon
return
lbl_HK20:
X = 20
if (RMode%X%) {
gosub lbl_HK_Rapid
return
}
gosub lbl_HK
return
lblNewProfile:
loop %Hotkeys_count%
{
if (Current_HK%A_Index% != "") {
Hotkey, % Current_HK%A_Index%, lbl_HK%A_Index%, off ;remove all current Hotkeys before loading profile
}
}
loop %Hotkeys_count%
{
GuiControl, , Shift%A_Index%, 0
GuiControl, , Ctrl%A_Index%, 0
GuiControl, , Alt%A_Index%, 0
GuiControl, , Win%A_Index%, 0
GuiControl, Choose, DDLHK%A_Index%, 1
GuiControl, Choose, DDLKCA%A_Index%, 1
GuiControl, Choose, DDLKCB%A_Index%, 1
GuiControl, Choose, DDLKCC%A_Index%, 1
GuiControl, , MyEdit%A_Index%,
GuiControl, , MyRadioA%A_Index%, 1
GuiControl, , MyRadioB%A_Index%, 0
GuiControl, , RMode%A_Index%, 0
Current_HK%A_Index% =
Old_HK%A_Index% =
}
GuiControl, , %id_ProfileName%, -
OpenedProfile =
ProfileName =
FileToLoad =
FileToSave =
Gui, Submit, NoHide
return
lblClear:
loop %Hotkeys_count%
{
if (Current_HK%A_Index% != "") {
Hotkey, % Current_HK%A_Index%, lbl_HK%A_Index%, off ;remove all current Hotkeys before loading profile
}
}
loop %Hotkeys_count%
{
GuiControl, , Shift%A_Index%, 0
GuiControl, , Ctrl%A_Index%, 0
GuiControl, , Alt%A_Index%, 0
GuiControl, , Win%A_Index%, 0
GuiControl, Choose, DDLHK%A_Index%, 1
GuiControl, Choose, DDLKCA%A_Index%, 1
GuiControl, Choose, DDLKCB%A_Index%, 1
GuiControl, Choose, DDLKCC%A_Index%, 1
GuiControl, , MyEdit%A_Index%,
GuiControl, , MyRadioA%A_Index%, 1
GuiControl, , MyRadioB%A_Index%, 0
GuiControl, , RMode%A_Index%, 0
Current_HK%A_Index% =
Old_HK%A_Index% =
}
Gui, Submit, NoHide
Return
lblLoad:
Gui +OwnDialogs
FileSelectFile, FileToLoad, 1 2 8 16, %A_WorkingDir%, Select Profile, *.khf
if (FileToLoad) {
loop %Hotkeys_count%
{
if (Current_HK%A_Index%) {
Hotkey, % Current_HK%A_Index%, lbl_HK%A_Index%, off ;remove all current hotkeys before loading profile
}
}
gosub lblClear ;clear all controls
loop %Hotkeys_count%
{
IniRead, ini_Shift%A_Index% , %FileToLoad%, Hotkey%A_Index%, Shift ;retrieving data from ini file
IniRead, ini_Ctrl%A_Index% , %FileToLoad%, Hotkey%A_Index%, Ctrl
IniRead, ini_Alt%A_Index% , %FileToLoad%, Hotkey%A_Index%, Alt
IniRead, ini_Win%A_Index% , %FileToLoad%, Hotkey%A_Index%, Win
IniRead, ini_DDLHK%A_Index% , %FileToLoad%, Hotkey%A_Index%, HK
IniRead, ini_DDLKCA%A_Index% , %FileToLoad%, Hotkey%A_Index%, KCA
IniRead, ini_DDLKCB%A_Index% , %FileToLoad%, Hotkey%A_Index%, KCB
IniRead, ini_DDLKCC%A_Index% , %FileToLoad%, Hotkey%A_Index%, KCC
IniRead, ini_MyEdit%A_Index% , %FileToLoad%, Hotkey%A_Index%, MyEdit
IniRead, ini_MyRadioA%A_Index% , %FileToLoad%, Hotkey%A_Index%, Type
IniRead, ini_MyRadioB%A_Index% , %FileToLoad%, Hotkey%A_Index%, Execute
IniRead, ini_RMode%A_Index% , %FileToLoad%, Hotkey%A_Index%, RMode
}
DDL_Num = 0
DDL_DDLHK_ExactMatch: ;This label and the 3 labels below are used to choose exact match from DDL by getting the item position in the list, maybe there is an easier way?!
DDL_Num += 1
Loop,Parse,DropDownListItems,|
{
if (A_LoopField = ini_DDLHK%DDL_Num%) {
ini_DDLHK%DDL_Num% = %A_Index%
break
}
}
if (DDL_Num != Hotkeys_count) {
goto DDL_DDLHK_ExactMatch
}
DDL_Num = 0
DDL_DDLKCA_ExactMatch:
DDL_Num += 1
Loop,Parse,DropDownListItems,|
{
if (A_LoopField = ini_DDLKCA%DDL_Num%) {
ini_DDLKCA%DDL_Num% = %A_Index%
break
}
}
if (DDL_Num != Hotkeys_count) {
goto DDL_DDLKCA_ExactMatch
}
DDL_Num = 0
DDL_DDLKCB_ExactMatch:
DDL_Num += 1
Loop,Parse,DropDownListItems,|
{
if (A_LoopField = ini_DDLKCB%DDL_Num%) {
ini_DDLKCB%DDL_Num% = %A_Index%
break
}
}
if (DDL_Num != Hotkeys_count) {
goto DDL_DDLKCB_ExactMatch
}
DDL_Num = 0
DDL_DDLKCC_ExactMatch:
DDL_Num += 1
Loop,Parse,DropDownListItems,|
{
if (A_LoopField = ini_DDLKCC%DDL_Num%) {
ini_DDLKCC%DDL_Num% = %A_Index%
break
}
}
if (DDL_Num != Hotkeys_count) {
goto DDL_DDLKCC_ExactMatch
}
loop %Hotkeys_count%
{
GuiControl, , Shift%A_Index%, % ini_Shift%A_Index% ;filling the controls by the retrieved data
GuiControl, , Ctrl%A_Index%, % ini_Ctrl%A_Index%
GuiControl, , Alt%A_Index%, % ini_Alt%A_Index%
GuiControl, , Win%A_Index%, % ini_Win%A_Index%
GuiControl, Choose, DDLHK%A_Index%, % ini_DDLHK%A_Index%
GuiControl, Choose, DDLKCA%A_Index%, % ini_DDLKCA%A_Index%
GuiControl, Choose, DDLKCB%A_Index%, % ini_DDLKCB%A_Index%
GuiControl, Choose, DDLKCC%A_Index%, % ini_DDLKCC%A_Index%
GuiControl, , MyEdit%A_Index%, % ini_MyEdit%A_Index%
GuiControl, , MyRadioA%A_Index%, % ini_MyRadioA%A_Index%
GuiControl, , MyRadioB%A_Index%, % ini_MyRadioB%A_Index%
GuiControl, , RMode%A_Index%, % ini_RMode%A_Index%
}
loop %Hotkeys_count%
{
gosub lbl%A_Index% ; Activating loaded hotkeys
}
Gui, Submit, NoHide ; updating variables associated with controls "if any"
OpenedProfile = %FileToLoad%
SplitPath, OpenedProfile, , , , ProfileName
GuiControl, , %id_ProfileName%, %ProfileName%
}
return
lblSave:
if (OpenedProfile)
{
loop %Hotkeys_count%
{
IniWrite, % Shift%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Shift
IniWrite, % Ctrl%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Ctrl
IniWrite, % Alt%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Alt
IniWrite, % Win%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Win
IniWrite, % DDLHK%A_Index% , %OpenedProfile%, Hotkey%A_Index%, HK
IniWrite, % DDLKCA%A_Index% , %OpenedProfile%, Hotkey%A_Index%, KCA
IniWrite, % DDLKCB%A_Index% , %OpenedProfile%, Hotkey%A_Index%, KCB
IniWrite, % DDLKCC%A_Index% , %OpenedProfile%, Hotkey%A_Index%, KCC
IniWrite, % MyEdit%A_Index% , %OpenedProfile%, Hotkey%A_Index%, MyEdit
IniWrite, % MyRadioA%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Type
IniWrite, % MyRadioB%A_Index% , %OpenedProfile%, Hotkey%A_Index%, Execute
IniWrite, % RMode%A_Index% , %OpenedProfile%, Hotkey%A_Index%, RMode
}
}
else
{
gosub lblSaveAs
}
return
lblSaveAs:
Gui +OwnDialogs
FileSelectFile, FileToSave, S 1 2 8 16, %A_WorkingDir%, Save Profile As, *.khf
if (FileToSave) {
loop %Hotkeys_count%
{
IniWrite, % Shift%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Shift
IniWrite, % Ctrl%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Ctrl
IniWrite, % Alt%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Alt
IniWrite, % Win%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Win
IniWrite, % DDLHK%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, HK
IniWrite, % DDLKCA%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, KCA
IniWrite, % DDLKCB%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, KCB
IniWrite, % DDLKCC%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, KCC
IniWrite, % MyEdit%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, MyEdit
IniWrite, % MyRadioA%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Type
IniWrite, % MyRadioB%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, Execute
IniWrite, % RMode%A_Index% , %FileToSave%.khf, Hotkey%A_Index%, RMode
}
OpenedProfile = %FileToSave%.khf
SplitPath, OpenedProfile, , , , ProfileName
GuiControl, , %id_ProfileName%, %ProfileName%
}
return
lblRestart:
Reload
return
lblabout:
Gui +OwnDialogs
MsgBox,64, Ultimate KeyBinder, Created by: Khalid Fawzy. `nE-Mail: [email protected]. `nCreated using: AutoHotKey_L Unicode 32.
return
lblRefresh:
Gui, Submit, NoHide
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment