Skip to content

Commit

Permalink
v1.4 enable/disable F4MM for Lister & Find Files,
Browse files Browse the repository at this point in the history
and use F4Edit= setting for Lister ...
  • Loading branch information
hi5 committed Jan 25, 2024
1 parent b8f6992 commit 661b39c
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 22 deletions.
31 changes: 21 additions & 10 deletions F4MiniMenu.ahk
Original file line number Diff line number Diff line change
@@ -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))
Expand All @@ -20,10 +20,10 @@ SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode, 2
; Setup variables, menu, hotkeys etc

F4Version:="v1.3"
F4Version:="v1.4"

; <for compiled scripts>
;@Ahk2Exe-SetFileVersion 1.3
;@Ahk2Exe-SetFileVersion 1.4
;@Ahk2Exe-SetDescription F4MiniMenu: Open files from TC
;@Ahk2Exe-SetCopyright MIT License - (c) https://github.com/hi5
; </for compiled scripts>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -448,6 +453,8 @@ GetFiles()
{
WinGetActiveTitle, Files
Files:=RegExReplace(Files,"U)^.*\[(.*).$","$1")
If (ListerWindowClose > 1)
WinClose, A
Return Files
}

Expand Down Expand Up @@ -1047,6 +1054,8 @@ FileAppend,
<Explorer>0</Explorer>
<Everything>0</Everything>
<MaxWinWaitSec>2</MaxWinWaitSec>
<Lister>1</Lister>
<FindFiles>1</FindFiles>
</Invalid_Name>
<Invalid_Name id="1" ahk="True">
<Exe>c:\WINDOWS\notepad.exe</Exe>
Expand Down Expand Up @@ -1077,6 +1086,8 @@ FullMenu=z
Explorer=0
Everything=0
MaxWinWaitSec=2
Lister=1
FindFiles=1
[1]
delay=0
exe=c:\WINDOWS\notepad.exe
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
33 changes: 23 additions & 10 deletions inc/Settings.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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
/*
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions inc/TotalCommanderPath.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/iob.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
6 changes: 5 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# F4MiniMenu - v1.3
# F4MiniMenu - v1.4

A <kbd>F4</kbd> 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)).
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 661b39c

Please sign in to comment.