From 661b39ceaed18a2fd0a38dd0352b5f238c149015 Mon Sep 17 00:00:00 2001 From: hi5 Date: Thu, 25 Jan 2024 21:55:46 +0100 Subject: [PATCH] v1.4 enable/disable F4MM for Lister & Find Files, and use F4Edit= setting for Lister ... --- F4MiniMenu.ahk | 31 +++++++++++++++++++++---------- changelog.md | 4 ++++ inc/Settings.ahk | 33 +++++++++++++++++++++++---------- inc/TotalCommanderPath.ahk | 8 ++++++++ lib/iob.ahk | 2 +- readme.md | 6 +++++- 6 files changed, 62 insertions(+), 22 deletions(-) diff --git a/F4MiniMenu.ahk b/F4MiniMenu.ahk index 8d5d0be..2d4405e 100644 --- a/F4MiniMenu.ahk +++ b/F4MiniMenu.ahk @@ -1,7 +1,7 @@ /* Script : F4MiniMenu.ahk for Total Commander - AutoHotkey 1.1+ (Ansi and Unicode) -Version : v1.3 +Version : v1.4 Author : hi5 Last update : 21 November 2023 Purpose : Minimalistic clone of the F4 Menu program for Total Commander (open selected files in editor(s)) @@ -20,10 +20,10 @@ SetWorkingDir, %A_ScriptDir% SetTitleMatchMode, 2 ; Setup variables, menu, hotkeys etc -F4Version:="v1.3" +F4Version:="v1.4" ; -;@Ahk2Exe-SetFileVersion 1.3 +;@Ahk2Exe-SetFileVersion 1.4 ;@Ahk2Exe-SetDescription F4MiniMenu: Open files from TC ;@Ahk2Exe-SetCopyright MIT License - (c) https://github.com/hi5 ; @@ -54,12 +54,6 @@ TmpFileList .= "\$$f4mtmplist$$.m3u" GroupAdd, TCOnly, ahk_class TTOTAL_CMD ahk_exe TOTALCMD.EXE GroupAdd, TCOnly, ahk_class TTOTAL_CMD ahk_exe TOTALCMD64.EXE -GroupAdd, TCF4Windows, ahk_class TTOTAL_CMD ahk_exe TOTALCMD.EXE -GroupAdd, TCF4Windows, ahk_class TTOTAL_CMD ahk_exe TOTALCMD64.EXE -GroupAdd, TCF4Windows, ahk_class TLister -GroupAdd, TCF4Windows, ahk_class TFindFile -GroupAdd, TCF4Windows, ahk_class TQUICKSEARCH - FileDelete, % TmpFileList Try @@ -127,6 +121,17 @@ If (Error = 1) ; Create backup file FileCopy, %F4ConfigFile%, %F4ConfigFile%.bak, 1 +; Hotkey groups (menus) +GroupAdd, TCF4Windows, ahk_class TTOTAL_CMD ahk_exe TOTALCMD.EXE +GroupAdd, TCF4Windows, ahk_class TTOTAL_CMD ahk_exe TOTALCMD64.EXE +GroupAdd, TCF4Windows, ahk_class TQUICKSEARCH + +If MatchList.settings.Lister + GroupAdd, TCF4Windows, ahk_class TLister +If MatchList.settings.FindFiles + GroupAdd, TCF4Windows, ahk_class TFindFile + + ; Add other file managers if any If MatchList.settings.Explorer { @@ -400,7 +405,7 @@ GetExt(Files) ; Get a list of selected files using internal TC commands (see totalcmd.inc for references) GetFiles() { - Global MatchList, CLI_Exit, CLI_File + Global MatchList, CLI_Exit, CLI_File, ListerWindowClose If CLI_Exit { @@ -448,6 +453,8 @@ GetFiles() { WinGetActiveTitle, Files Files:=RegExReplace(Files,"U)^.*\[(.*).$","$1") + If (ListerWindowClose > 1) + WinClose, A Return Files } @@ -1047,6 +1054,8 @@ FileAppend, 0 0 2 + 1 + 1 c:\WINDOWS\notepad.exe @@ -1077,6 +1086,8 @@ FullMenu=z Explorer=0 Everything=0 MaxWinWaitSec=2 +Lister=1 +FindFiles=1 [1] delay=0 exe=c:\WINDOWS\notepad.exe diff --git a/changelog.md b/changelog.md index c1dd52f..de20be0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ ## Changelog +* 20240123 - v1.4 a) New: enable/disable F4MM for Lister and Find Files (search results) windows (see settings). If Lister setting is active and F4Edit>1 in wincmd.ini: close Lister + In TC 11.03 the press "F4 to open currently viewed file in Lister" was added. + (See F4Edit= options in TC help file on how to handle F4 in lister via wincmd.ini. F4TCIE _could_ be used.) + * 20231121 - v1.3 a) Fix: `%N` and `%M` now processed correctly b) Added "#Requires AutoHotkey v1.1.31+" directive for users with v1 & v2 installed, added note in documention about using v1 AutoHotkey.exe in setup diff --git a/inc/Settings.ahk b/inc/Settings.ahk index ac06a14..9d030ef 100644 --- a/inc/Settings.ahk +++ b/inc/Settings.ahk @@ -151,23 +151,34 @@ Gui, Settings: Add, Button, % dpi("xp+170 yp-75 w120 h25 gButtonOK"), OK Gui, Settings: Add, Button, % dpi("xp yp+40 w120 h25 gButtonClear"), Clear All Hotkeys Gui, Settings: Add, Button, % dpi("xp yp+40 w120 h25 gSettingsGuiClose"), Cancel -Gui, Settings: Add, GroupBox, % dpi("x16 yp+40 w540 h72"), Other programs +Gui, Settings: Add, GroupBox, % dpi("x16 yp+40 w260 h72"), Other programs + +Gui, Settings: Add, Text, % dpi("x25 yp+20 w100 h20"), Dbl Cmd: +Gui, Settings: Add, Hotkey, % dpi("xp+52 yp-3 w90 h20 vDoubleCommander"), % MatchList.settings.DoubleCommander + +Gui, Settings: Add, Text, % dpi("x25 yp+30 w50 h20"), XYPlorer: +Gui, Settings: Add, Hotkey, % dpi("xp+52 yp-3 w90 h20 vXYPlorer"), % MatchList.settings.XYPlorer Checked:=MatchList.settings.Explorer -Gui, Settings: Add, Checkbox, % dpi("x25 yp+20 w60 h16 Checked" checked " vExplorer"), Explorer +Gui, Settings: Add, Checkbox, % dpi("xp+100 yp-25 w60 h16 Checked" checked " vExplorer"), Explorer + +Checked:=MatchList.settings.Everything +Gui, Settings: Add, Checkbox, % dpi("xp yp+28 w80 h16 Checked" checked " vEverything"), Everything -Gui, Settings: Add, Text, % dpi("xp+70 yp+1 w100 h20"), Double Commander: -Gui, Settings: Add, Hotkey, % dpi("xp+100 yp-3 w90 h20 vDoubleCommander"), % MatchList.settings.DoubleCommander -Gui, Settings: Add, Text, % dpi("xp+100 yp+3 w50 h20"), XYPlorer: -Gui, Settings: Add, Hotkey, % dpi("xp+50 yp-3 w90 h20 vXYPlorer"), % MatchList.settings.XYPlorer Gui, Settings: Font, % dpi("s8 cGreen") -Gui, Settings: Add, Text, % dpi("xp+175 yp gFMMFileManText"), (?) +Gui, Settings: Add, Text, % dpi("xp+70 yp-28 gFMMFileManText"), (?) Gui, Settings: Font, % dpi("cBlack") Gui, Settings: Font, ; see note above, required to reset style Gui, Settings: Font, % dpi("s8") -Checked:=MatchList.settings.Everything -Gui, Settings: Add, Checkbox, % dpi("x25 yp+30 w100 h16 Checked" checked " vEverything"), Everything +Gui, Settings: Add, GroupBox, % dpi("xp+35 yp-19 w270 h72"), Use elsewhere in TC (no menu) + +Checked:=MatchList.settings.Lister +Gui, Settings: Add, Checkbox, % dpi("xp+10 yp+20 w240 h16 Checked" checked " vLister"), Lister (+ use F4Edit setting in wincmd.ini) + +Checked:=MatchList.settings.FindFiles +Gui, Settings: Add, Checkbox, % dpi("xp yp+28 w100 h16 Checked" checked " vFindFiles"), Find Files + ; Note: deactivated Everything Directory Tree and DocumentTemplates settings for now /* @@ -262,6 +273,8 @@ MatchList.settings.Everything:=Everything ;MatchList.settings.EVDirTree:=EVDirTree MatchList.settings.DoubleCommander:=DoubleCommander MatchList.settings.XYPlorer:=XYPlorer +MatchList.settings.Lister:=Lister +MatchList.settings.FindFiles:=FindFiles HotKeyState:="On" Gosub, SetHotkeys @@ -310,7 +323,7 @@ MsgBox, 8224, Other file managers (experimental), F4MiniMenu can also work with other programs.`nTo activate enter the keyboard shortcut to "Copy Filename(s) with Full Path"`n` Double Commander default:`tShift+Ctrl+C`n XYPlorer default:`tCtrl+p`n -Everything:`tCheckbox to use F4MiniMenu`n +Explorer, Everything:`tCheckbox to use F4MiniMenu`n Note: use at your own risk. ) ;Ev DirTree:`tReplace TC Dir Tree (Alt-F10)`n diff --git a/inc/TotalCommanderPath.ahk b/inc/TotalCommanderPath.ahk index c00d7bb..1546d3c 100644 --- a/inc/TotalCommanderPath.ahk +++ b/inc/TotalCommanderPath.ahk @@ -3,6 +3,14 @@ ; try to get Commander_Path, it will be empty if TC is not running (yet) EnvGet, Commander_Path, Commander_Path +ListerWindowClose:=0 +EnvGet, Commander_Ini_Path, Commander_Ini_Path +If (Commander_Ini_Path <> "") + { + Commander_Ini_Path .= "\wincmd.ini" + IniRead, ListerWindowClose, %Commander_Ini_Path%, Lister, F4Edit, 0 + } + If (Commander_Path = "") ; try to read registry RegRead Commander_Path, HKEY_CURRENT_USER, Software\Ghisler\Total Commander, InstallDir diff --git a/lib/iob.ahk b/lib/iob.ahk index 0707e25..7511a61 100644 --- a/lib/iob.ahk +++ b/lib/iob.ahk @@ -64,7 +64,7 @@ iob_save(ObjectName,Filename="") { ; Object parameter isn't used but just added iob_getkeys(section) { If (Section = 1) - Return "BackgroundHotkey,ForegroundHotkey,MaxFiles,MenuPos,FilteredMenuAutoEdit,MaxWinWaitSec,TCPath,TCStart,F4MMCloseAll,F4MMClosePID,FilteredHotkey,FullMenu,Explorer,Everything,DoubleCommander,XYPlorer" ; ,EvPath,EVDirTree + Return "BackgroundHotkey,ForegroundHotkey,MaxFiles,MenuPos,FilteredMenuAutoEdit,MaxWinWaitSec,TCPath,TCStart,F4MMCloseAll,F4MMClosePID,FilteredHotkey,FullMenu,Explorer,Everything,DoubleCommander,XYPlorer,Lister,FindFiles" ; ,EvPath,EVDirTree If (Section = 2) Return "Delay,Exe,Ext,Method,Open,Windowmode,StartDir,Parameters,Icon,Name" } diff --git a/readme.md b/readme.md index 8423c9b..f8c4fbd 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# F4MiniMenu - v1.3 +# F4MiniMenu - v1.4 A F4 Menu program for [Total Commander](http://www.ghisler.com/) to open selected file(s) in editor(s). (and experimental/rudimentary support for Windows Explorer, Double Commander, XYPlorer, and Everything - only [when activated](#other-programs)). @@ -117,6 +117,10 @@ Once F4MiniMenu is started, the Global settings and new editors with a variety o - Filtered menu * Other programs - Explorer, Double Commander, XYPlorer, Everything. +* Use elsewhere in TC + - Lister(1), Find Files + +(1) If Lister setting is active _and_ F4Edit>1 in wincmd.ini: _close Lister window_ - See `F4Edit=` options in TC help file on how to handle F4 in lister via wincmd.ini (Introduced in TC v11.03). __WinWait__ Set the maximum time in seconds to wait for the selected program window to appear before applying the selected Window Mode (Normal, Maximized, Minimized -- see Editor configuration). This should also prevent any unexpected "waiting" in case a program launch failed (crash, very slow program start etc). As soon as the window appears it will continue to apply the Window mode and no longer wait.