Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 【 LICENCE 】
- --------------------------------------------------------------------------------
- -- The MIT License (MIT)
- --
- -- Copyright (c) mece from opencheattables.org
- --
- -- Permission is hereby granted, free of charge, to any person obtaining a
- -- copy of this software and associated documentation files (the "Software"),
- -- to deal in the Software without restriction, including without limitation
- -- the rights to use, copy, modify, merge, publish, distribute, sublicense,
- -- and/or sell copies of the Software, and to permit persons to whom the
- -- Software is furnished to do so, subject to the following conditions:
- --
- -- The above copyright notice and this permission notice shall be included in
- -- all copies or substantial portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- -- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- -- DEALINGS IN THE SOFTWARE.
- --------------------------------------------------------------------------------
- -- 【 FILE INFO 】
- -- ㅤ❖ This is an extention for Cheat Engine 7.4 (https://cheatengine.org)
- --
- -- 【 FEATURES 】
- -- ㅤ❖ Press Ctrl+Tab once to switch between the last two focused CE windows
- -- ㅤ❖ Press Ctrl+Tab multiple times switch to the selected window from the list
- -- ㅤ❖ Release Ctrl to hide the window list
- -- ㅤ❖ While Ctrl is down the window list is visible
- -- ㅤㅤ Use Up and Down arrow keys or mouse left clicks to switch windows
- -- ㅤ❖ Press Delete to close selected window (except the main one)
- -- ㅤ❖ Switch minimized window to temporary restore it
- -- ㅤㅤ Release Ctrl to keep window restored
- --
- -- 【 HOW TO INSTALL 】
- -- ㅤ❖ Place the .lua file in CE autorun folder. Could be:
- -- ㅤㅤ C:\Program Files\Cheat Engine 7.4\autorun
- -- ㅤ❖ Place the .frm file in CE autorun\forms folder. Could be:
- -- ㅤㅤ C:\Program Files\Cheat Engine 7.4\autorun\forms
- --
- -- 【 CHANGE LOG 】
- -- ㅤ⋯ 2022-06-03 ⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯⋯
- -- ㅤ❖ initial version
- --
- -- 【 CONTACT THE AUTHOR 】
- -- ㅤ❖ https://opencheattables.org/viewforum.php?f=14
- -- ㅤ❖ https://forum.cheatengine.org/viewforum.php?f=130
- --
- --------------------------------------------------------------------------------
- local wsw = {}
- local pathsep = getOperatingSystem() and [[\]] or [[/]]
- local forms_path = getAutoRunPath()..'forms'..pathsep
- wsw.maximized_form = nil
- --------------------------------------------------------------------------------
- local function show_switcher()
- if wsw.tab_hotkey_enabled and getCheatEngineProcessID() == getForegroundProcess() then
- wsw.tab_hotkey_enabled = false
- local lb = CEFormWindowSwitcher.CEListBoxWindows
- lb.Items.beginUpdate()
- lb.Items.clear()
- for i=0,getFormCount()-1 do
- local form = getForm(i)
- if form.Visible and form ~= CEFormWindowSwitcher then
- lb.Items.add(form.Caption, userDataToInteger(form))
- end
- end
- wsw.maximized_form = nil
- lb.Items.endUpdate()
- CEFormWindowSwitcher.show()
- lb.ItemIndex = lb.Items.Count > 1 and 1 or 0
- end
- end
- --------------------------------------------------------------------------------
- function CEFormWindowSwitcher_CEListBoxWindows_OnSelectionChange(sender, user)
- if wsw.maximized_form then
- wsw.maximized_form.WindowState = 'wsMinimized'
- wsw.maximized_form = nil
- end
- local form = integerToUserData(sender.Items.Data[sender.ItemIndex])
- if form.WindowState == 'wsMinimized' then
- form.WindowState = 'wsNormal'
- wsw.maximized_form = form
- end
- form.bringToFront()
- sender.setFocus()
- end
- --------------------------------------------------------------------------------
- function CEFormWindowSwitcher_CEListBoxWindows_OnKeyDown(sender, key)
- local list = sender.Items
- local start = sender.ItemIndex
- if key == VK_TAB then
- sender.ItemIndex = start < list.Count-1 and start + 1 or 0
- end
- if key == VK_DELETE then
- local form = integerToUserData(list.Data[sender.ItemIndex])
- if form ~= MainForm then
- form.Close()
- local selected = sender.ItemIndex
- list.delete(selected)
- sender.ItemIndex = selected > 1 and selected-1 or 0
- end
- end
- return key
- end
- --------------------------------------------------------------------------------
- local function control_modifier()
- if wsw.control_hotkey_enabled then
- wsw.control_hotkey_enabled = false
- wsw.tab_hotkey_enabled = true
- wsw.waitTab = createTimer(MainForm)
- wsw.waitTab.Interval = 200
- wsw.waitTab.OnTimer = function(thisTimer)
- if not isKeyPressed(VK_CONTROL) then
- CEFormWindowSwitcher.close()
- wsw.tab_hotkey_enabled = false
- wsw.control_hotkey_enabled = true
- thisTimer.destroy()
- end
- end
- end
- end
- --------------------------------------------------------------------------------
- function file_exists(file_path)
- local f = io.open(file_path, "r")
- return f ~= nil and io.close(f)
- end
- --------------------------------------------------------------------------------
- local CEFormWindowSwitcher = nil
- local file_path = forms_path .. 'WindowSwitcher.FRM'
- if file_exists(file_path) then
- CEFormWindowSwitcher = createFormFromFile(file_path)
- wsw.control_hotkey = createHotkey(control_modifier, VK_CONTROL)
- wsw.control_hotkey_enabled = true
- wsw.tab_hotkey = createHotkey(show_switcher, VK_TAB)
- wsw.tab_hotkey_enabled = false
- else
- print("WindowSwitcher.FRM not found!")
- end
- --------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement