--[===[ Author: YoucefHam Email: youcefham20@gmail.com Discord: YoucefHam#5634 ADD to Edit Menu "Hotkey Manager" "Get Table Hotkeys", => This will show you a list with all the Memory records that have Hotkeys. "Remove All Hotkeys", => This will remove all the Hotkeys from All the Memory records. ]===] local HotkeysManagerName = 'miHotkeysManager' local HotkeysManagerCaption = '&Hotkey Manager' local miHotkeysManager -- Get Table Hotkeys function GetHotkeys() local mr = getAddressList() if mr.Count > 0 then local _GetHotKeys = "" local _KeyCode = {[1]="LBUTTON",[2]="RBUTTON",[3]="CANCEL",[4]="MBUTTON",[5]="XBUTTON1",[6]="XBUTTON2",[8]="Backspace",[9]="TAB",[12]="Clear",[13]="Enter",[16]="SHIFT",[17]="CONTROL",[18]="ALT",[19]="PAUSE",[20]="CAPSLOCK",[27]="ESCAPE",[32]="SPACE",[33]="PGUP",[34]="PGDOWN",[35]="NumpadEnd",[36]="HOME",[37]="LEFT_ARROW",[38]="UP_ARROW",[39]="RIGHT_ARROW",[40]="DOWN_ARROW",[41]="SELECT",[42]="PrintScreen",[43]="EXECUTE",[44]="SNAPSHOT",[45]="INSERT",[46]="DELETE",[47]="HELP",[48]="0",[49]="1",[50]="2",[51]="3",[52]="4",[53]="5",[54]="6",[55]="7",[56]="8",[57]="9",[65]="A",[66]="B",[67]="C",[68]="D",[69]="E",[70]="F",[71]="G",[72]="H",[73]="I",[74]="J",[75]="K",[76]="L",[77]="M",[78]="N",[79]="O",[80]="P",[81]="Q",[82]="R",[83]="S",[84]="T",[85]="U",[86]="V",[87]="W",[88]="X",[89]="Y",[90]="Z",[91]="LWIN",[92]="RWIN",[93]="AppsKey",[95]="Sleep",[96]="NUMPAD0",[97]="NUMPAD1",[98]="NUMPAD2",[99]="NUMPAD3",[100]="NUMPAD4",[101]="NUMPAD5",[102]="NUMPAD6",[103]="NUMPAD7",[104]="NUMPAD8",[105]="NUMPAD9",[106]="NUMPAD_MULTIPLY",[107]="NUMPAD_ADD",[108]="SEPARATOR",[109]="NUMPAD_SUBTRACT",[110]="NUMPAD_DECIMAL",[111]="NUMPAD_DIVIDE",[112]="F1",[113]="F2",[114]="F3",[115]="F4",[116]="F5",[117]="F6",[118]="F7",[119]="F8",[120]="F9",[121]="F10",[122]="F11",[123]="F12",[124]="F13",[125]="F14",[126]="F15",[127]="F16",[128]="F17",[129]="F18",[130]="F19",[131]="F20",[132]="F21",[133]="F22",[134]="F23",[135]="F24",[144]="NUMLOCK",[145]="SCROLLLOCK",[156]="WheelLeft",[157]="WheelRight",[158]="WheelDown",[159]="WheelUp",[160]="LSHIFT",[161]="RSHIFT",[162]="LCONTROL",[163]="RCONTROL",[164]="LALT",[165]="RALT",[166]="Browser_Back",[167]="Browser_Forward",[168]="Browser_Refresh",[169]="Browser_Stop",[170]="Browser_Search",[171]="Browser_Favorites",[172]="Browser_Home",[173]="Volume_Mute",[174]="Volume_Down",[175]="Volume_Up",[176]="Media_Next",[177]="Media_Prev",[178]="Media_Stop",[179]="Media_Play_Pause",[180]="Launch_Mail",[181]="Launch_Media",[182]="Launch_App1",[183]="Launch_App2",[186]=";",[187]="=",[188]=",",[189]="-",[190]=".",[191]="/",[192]="`"} for _Record = 0 , mr.Count - 1 do -- Read all records in the Table local _keyCount = mr[_Record].HotkeyCount -- Get How many keys if _keyCount > 0 then local _HotKeys = "" for _Hotkey = 0, _keyCount - 1 do -- Read All key list local _Keys = "" local _KeyData = mr[_Record].Hotkey[_Hotkey].Keys -- Get How many unique keys for _Modifiers = 1, #_KeyData do if _KeyCode[mr[_Record].Hotkey[_Hotkey].Keys[_Modifiers]] ~= nil then if _Modifiers == 1 then _Keys = _KeyCode[mr[_Record].Hotkey[_Hotkey].Keys[_Modifiers]] else _Keys = _Keys.." + ".._KeyCode[mr[_Record].Hotkey[_Hotkey].Keys[_Modifiers]] end else if _Modifiers == 1 then _Keys = "VK0"..mr[_Record].Hotkey[_Hotkey].Keys[_Modifiers] else _Keys = _Keys.." + ".."VK0"..mr[_Record].Hotkey[_Hotkey].Keys[_Modifiers] end end end if _Hotkey == 0 then _HotKeys = _Keys else _HotKeys = _HotKeys.."; ".._Keys end end _GetHotKeys = _GetHotKeys.."Rec: "..mr[_Record].getDescription().."\n HotKeys: ".._HotKeys.."\n" end end if #_GetHotKeys > 1 then showMessage(_GetHotKeys) else showMessage("No HotKeys Found!!!") end end end -- Remove All Hotkeys function removeAllHotkeys() local mr = getAddressList() if mr.Count > 0 then local _isRemovedAny = false for _Record = 0 , mr.Count - 1 do -- Read all records in the Table local _keyCount = mr[_Record].HotkeyCount -- Get How many keys if _keyCount > 0 then _isRemovedAny = true for __i = _keyCount - 1, 0, -1 do -- Destroy all HotKeys in the record mr[_Record].Hotkey[__i].Destroy() end end end if _isRemovedAny then showMessage("All Hotkeys Removed") else showMessage("No HotKeys Found!!!") end end end -- Add menus local function addMenuItem(MenuItem, caption, onClick) local newItem = createMenuItem(MenuItem) MenuItem.add(newItem) newItem.Caption = caption newItem.OnClick = onClick return newItem end -- create Hotkey Manager local function addHotkeysManagerMenu() if not getMainForm().ComponentByName['Edit3'].Visible then getMainForm().ComponentByName['Edit3'].Visible = true end local parent = getMainForm().ComponentByName['Edit3'] or getMainForm().Menu.Items local separatorMenu = createMenuItem(parent) separatorMenu.Caption = '-' parent.add(separatorMenu) local miHotkeysManager = createMenuItem(parent) miHotkeysManager.Name = HotkeysManagerName miHotkeysManager.Caption = HotkeysManagerCaption parent.add(miHotkeysManager) addMenuItem(miHotkeysManager,translate('&Get Table Hotkeys'), GetHotkeys) addMenuItem(miHotkeysManager,'-') addMenuItem(miHotkeysManager,translate('&Remove All Hotkeys'), removeAllHotkeys) end addHotkeysManagerMenu()