Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Hotkey list and clean all hotkeys

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
DhaosCollider
How do I cheat?
Reputation: 0

Joined: 12 Mar 2022
Posts: 4

PostPosted: Thu Feb 09, 2023 6:35 am    Post subject: Hotkey list and clean all hotkeys Reply with quote

Features:
  • Add Hotkeys menu
  • View Hotkey list
    (Select one from the list to invoke the target hotkey form)
  • Clean all Hotkeys

Notes:
  • Its recommended to throw lua file into CE's autorun folder.
  • Not confirmed to work with CE 7.1 or lower.

AA script code:
Code:
{$lua}
if syntaxcheck then return end
---------------------------------------------------------------------------------------------------
-- addHotKeyInfoItem functions
---------------------------------------------------------------------------------------------------
local function assignListAndTable(mr, list, tbl)
    if not (0 < mr.HotkeyCount) then return end
    for i = 0, mr.HotkeyCount - 1 do
        local str = ('%s: %s'):format(mr.Hotkey[i].hotkeyString, mr.description)
        if str then list.add(str); tbl[#tbl + 1] = mr.index end
    end
end
---------------------------------------------------------------------------------------------------
local function getIndex()
    local al, hl, il = getAddressList(), createStringList(), {}
    for i = 0, al.count - 1 do assignListAndTable(al[i], hl, il) end
    local id = showSelectionList('Hotkeys', '', hl)
    hl.destroy()
    return (-1 < id) and il[id + 1]
end
---------------------------------------------------------------------------------------------------
local function viewSetHotkeys()
    local index = getIndex()
    if not index then return end
    local al, mf = getAddressList(), getMainForm()
    al.setSelectedRecord(al[index]); mf.SetHotkey1.doClick()
end
---------------------------------------------------------------------------------------------------
local function cleanHotkeys(mr)
    if not (0 < mr.HotkeyCount) then return end
    for i = mr.HotkeyCount - 1, 0, -1 do mr.Hotkey[i].destroy() end
end
---------------------------------------------------------------------------------------------------
local function cleanAllHotkeys()
    local al = getAddressList()
    for i = 0, al.count - 1 do cleanHotkeys(al[i]) end
end
---------------------------------------------------------------------------------------------------
local function findHotkeyInfoItem(str)
    local mf = getMainForm()
    for i = mf.Menu.Items.count - 1, 0, -1 do
        local caption = mf.Menu.Items[i].caption
        if (caption == str) then return mf.Menu.Items[i] end
    end
end
---------------------------------------------------------------------------------------------------
local function addListViewMenu(Item)
    local ListViewMenu = createMenuItem(Item)
    Item.add(ListViewMenu)
    ListViewMenu.caption = 'List view'
    ListViewMenu.onClick = viewSetHotkeys
end
---------------------------------------------------------------------------------------------------
local function addCleanAllMenu(Item)
    local CleanAllMenu = createMenuItem(Item)
    Item.add(CleanAllMenu)
    CleanAllMenu.caption = 'Clean all'
    CleanAllMenu.onClick = cleanAllHotkeys
end
---------------------------------------------------------------------------------------------------
local function addHotkeyInfoItem()
    if findHotkeyInfoItem('&Hotkeys') then return end
    local mf = getMainForm()
    local HotKeyInfoItem = createMenuItem(mf.Menu.Items)
    mf.Menu.Items.add(HotKeyInfoItem)
    HotKeyInfoItem.caption = '&Hotkeys'
    addListViewMenu(HotKeyInfoItem); addCleanAllMenu(HotKeyInfoItem)
end
---------------------------------------------------------------------------------------------------
[ENABLE]

addHotkeyInfoItem()

[DISABLE]

findHotkeyInfoItem('&Hotkeys').destroy()



HotkeysMenu.png
 Description:
 Filesize:  5.89 KB
 Viewed:  7157 Time(s)

HotkeysMenu.png



HotkeyList.png
 Description:
 Filesize:  7.3 KB
 Viewed:  7158 Time(s)

HotkeyList.png



addHotKeyInfoItem.lua
 Description:
Edit 1.2: Fixed findHotkeyInfoItem to return TMenuItem.

Download
 Filename:  addHotKeyInfoItem.lua
 Filesize:  3.15 KB
 Downloaded:  696 Time(s)

Back to top
View user's profile Send private message
DeRol
Newbie cheater
Reputation: 0

Joined: 26 Aug 2009
Posts: 18

PostPosted: Tue Mar 07, 2023 1:53 am    Post subject: Reply with quote

Works great and convenient. Thanks!
Back to top
View user's profile Send private message
frogsaucer
How do I cheat?
Reputation: 0

Joined: 03 Feb 2024
Posts: 7

PostPosted: Sun Feb 25, 2024 12:01 pm    Post subject: Reply with quote

Does clean hotkeys mean delete or disable?

EDIT: Nevermind it deletes all. Is there a way to toggle off all hotkeys? It would greatly help my projects.
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 94

Joined: 14 Jul 2007
Posts: 3108

PostPosted: Mon Feb 26, 2024 2:09 am    Post subject: Reply with quote

frogsaucer wrote:
Is there a way to toggle off all hotkeys? It would greatly help my projects.

I ended up making a script for that.
Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>118</ID>
      <Description>"-- Disable CE HotKeys LUA script"</Description>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
getHotkeyHandlerThread().State='htsDisabled'

[DISABLE]
{$lua}
getHotkeyHandlerThread().State='htsActive'

</AssemblerScript>
    </CheatEntry>
  </CheatEntries>
</CheatTable>
Back to top
View user's profile Send private message
frogsaucer
How do I cheat?
Reputation: 0

Joined: 03 Feb 2024
Posts: 7

PostPosted: Wed Feb 28, 2024 12:30 am    Post subject: Reply with quote

Csimbi wrote:
frogsaucer wrote:
Is there a way to toggle off all hotkeys? It would greatly help my projects.

I ended up making a script for that.
Code:
<?xml version="1.0" encoding="utf-8"?>
<CheatTable>
  <CheatEntries>
    <CheatEntry>
      <ID>118</ID>
      <Description>"-- Disable CE HotKeys LUA script"</Description>
      <LastState/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]
{$lua}
getHotkeyHandlerThread().State='htsDisabled'

[DISABLE]
{$lua}
getHotkeyHandlerThread().State='htsActive'

</AssemblerScript>
    </CheatEntry>
  </CheatEntries>
</CheatTable>


Thank you so much, I will be using that sometime for sure.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites