F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Stefan2, white, sheep, Hacker

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

F4MiniMenu (AHK): F4Menu w. Drag&Drop, filelist, cmdline

Post by *hi5 » 2012-11-03, 11:57 UTC

Hi,

as I personally don't need all the functionality of F4Menu and because I needed Drag&Drop support opening of files to avoid multiple instances of my old graphics program I've written a minimalistic clone of F4Menu in AutoHotkey.

Introduction

F4 is the shortcut key used in Total Commander for opening selected files in a pre-defined program.
In TC only one program can be assigned to F4 making it impossible to define or select other editors for different file types. Several tools have been made to solve this problem, these include:

- ChoiceEditor, http://www.totalcmd.net/plugring/ChoiceEditor.html
- Open File shell for TC, http://www.totalcmd.net/plugring/OpenFileTC.html
- Total Commander Edit Redirector, http://ghisler.ch/board/viewtopic.php?t=27573
- and of course the original F4Menu, http://ghisler.ch/board/viewtopic.php?t=17003 (original download links offline, see the thread for backup links)

While the original F4Menu has quite a few options, this minimalistic "clone" only has the
basic functionality: opening multiple file types in various programs.

One additional feature is that it can open selected files using a "Drag & Drop" method (a personal requirement). As of v0.5 it also has "Filelist" support.

v0.9 (June 16th 2016) - wildcard support and included INI version for those who prefer to store settings in INI format.

v0.94b (January 14th 2017) - added 4th method: cmdline

v0.95 (July 2017) - added F4TCIE for internal edit command so it can be used in archives/FTP. DocumentTemplates (shift+F4) for new files.

Instructions, Source, Screenshots & Download:

AutoHotkey 1.1+ (Ansi and Unicode)
https://github.com/hi5/F4MiniMenu
(just click on the ZIP link to download all files and unpack)

Simply run the script and it will use the F4 hotkey, you can exit the script via the tray icon, right click, exit.

Edit July 1st 2013: Unicode now works, fixed some other issues
Edit Mar 30th 2013: removed unicode branch + added filelist info
Edit Dec 15th 2012: rewrote entire post
Last edited by hi5 on 2017-07-16, 08:19 UTC, edited 12 times in total.
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2012-11-25, 13:39 UTC

A new version is available with userfriendly guis. There are now also screenshots at the GitHub page.

edit: after this post posting links was allowed, so see first post or signature :D
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

User avatar
LonerD
Senior Member
Senior Member
Posts: 292
Joined: 2010-06-19, 20:18 UTC
Location: Donetsk

Post by *LonerD » 2012-12-03, 22:34 UTC

Thanks.
Great work.
But the configuration file in xml is complicated.
It would be more convenient in ini format.
Total Commander DreamLair - dream always, think totally, be the commander of you own life.

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom » 2012-12-03, 22:53 UTC

That and AHK has built in functions for handling/parsing/writing INI files.

Question? Why use "ANSI" ... if you are going to continue development of such a tool, I'd recommend switching to Unicode AHK_L -- if yer not using manual memory allocation you wont see much (if any) difference between the ANSI and Unicode AHK binaries.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2012-12-06, 18:42 UTC

Hi,

thanks for the feedback.
LonerD wrote:Thanks.
Great work.
But the configuration file in xml is complicated.
It would be more convenient in ini format.
As I make use of AHK 1.1+ Object's capabilities saving and loading settings as XML is just one command which makes it very easy for me to use.

With the v0.4 version of the script there is no particular need to edit the XML file manually as all settings can be changed via user friendly Gui's - you can see the screenshots on the GitHub page here https://github.com/hi5/F4MiniMenu#screenshots
(Settings available via the tray menu)
Balderstrom wrote:That and AHK has built in functions for handling/parsing/writing INI files.
True (IniRead/IniWrite/IniDelete), but they are also tedious to use if you want to read/store many variables even if you use Loops and some other tricks.
However, I did see some Ini <-> Object functions/libraries so I will look into that to see if they are as easy to use as the current XA library I'm using and I might switch.
Balderstrom wrote:Question? Why use "ANSI" ... if you are going to continue development of such a tool, I'd recommend switching to Unicode AHK_L -- if yer not using manual memory allocation you wont see much (if any) difference between the ANSI and Unicode AHK binaries.
I use ANSI because of the Drag & Drop function I currently use. That only works with AHK Ansi I'm afraid due to the DLL Call / NumPut functions it uses (they don't work in Unicode)
I did find a Unicode version but haven't been able to get it to work yet.

Ideally I would use one function for both the Ansi and Unicode versions of AHK and will keep looking into it.
(I'm not an experienced programmer so I have to use "advanced" functions as I find them).

I'll post here about any significant updates, see also the TODO list https://github.com/hi5/F4MiniMenu#todo---known-issues (below that you will the links to function I used as well)
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom » 2012-12-06, 19:18 UTC

hi5 wrote:
Balderstrom wrote:That and AHK has built in functions for handling/parsing/writing INI files.
True (IniRead/IniWrite/IniDelete), but they are also tedious to use if you want to read/store many variables even if you use Loops and some other tricks.
However, I did see some Ini <-> Object functions/libraries so I will look into that to see if they are as easy to use as the current XA library I'm using and I might switch.
I haven't found that to be the case ...

Here are the functions I use for reading/writing from/to TC's wincmd.ini

Code: Select all

TC_CheckINIRedirect( iniSection, wincmd )
{
	if(!wincmd)
		EnvGet, wincmd, COMMANDER_INI
	iniRead, iniRedirect, %wincmd%, %iniSection%, RedirectSection, %wincmd%
	SplitPath, iniRedirect, iniFile, iniPath
	if( !iniPath )
		SplitPath, wincmd, tmpFile, iniPath
return iniPath "" iniFile 
}

TC_iniRead( iniSection, iniKey, wincmd="" )
{
	iniFile := TC_CheckINIRedirect( iniSection, wincmd )
	IniRead, keyValue, %iniFile%, %iniSection%, %iniKey%, %A_Space%
return keyValue
}

TC_iniWrite( value, iniSection, iniKey, wincmd="" )
{
	iniFile := TC_CheckINIRedirect( iniSection, wincmd )
	IniWrite, %value%, %iniFile%, %iniSection%, %iniKey%
return
}	
So you would be dealing with your own .ini, and not need to worry about things like redirection of the given section.

Code: Select all

F4MM_iniWrite( value, iniSection, iniKey, iniFile="F4MiniMenu.ini" )
{
	IniRead, keyValue, %iniFile%, %iniSection%, %iniKey%, %A_Space% 
return keyValue
}

F4MM_iniRead( iniSection, iniKey, iniFile="F4MiniMenu.ini" )
{
	IniWrite, %value%, %iniFile%, %iniSection%, %iniKey%
}

F4MM_INIT(iniFile="F4MiniMenu.ini")
{
	Global
	local configVars:="foo,bar,baz,foz" ; variables under [Config]
	local gVarName

	Loop, Parse, configVars, `,
	{
		gVarName:="F4MM_" A_LoopField
		%gVarName%:=F4MM_iniRead( "Config", A_LoopField )

	}
}
Working Example, using a fake F4MM_iniReadExample function to show input/output.

Code: Select all

F4MM_INIT()
F4MM_ShowVars()
return

F4MM_iniReadExample( iniSection, iniKey )
{
	random, rand, 1,10
	return "example" rand "_" iniKey
}

F4MM_INIT(iniFile="F4MiniMenu.ini")
{
	Global
	local configVars:="foo,bar,baz,foz" ; variables under [Config]
	local gVarName

	Loop, Parse, configVars, `,
	{
		gVarName:="F4MM_" A_LoopField
		%gVarName%:=F4MM_iniReadExample( "Config", A_LoopField )
	}
}

F4MM_ShowVars()
{
	Global

	local configVars:="foo,bar,baz,foz" ; variables under [Config]
	local tmpV

	Loop, Parse, configVars, `,
	{
		tmpV:="F4MM_" A_LoopField
		MsgBox, % tmpV ":: " %tmpV%
	}
}

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2012-12-06, 20:10 UTC

Thanks for the example, and I know there are INI libraries (not using Objects) on the AHK forum as well (which I didn't like) but I still think it is "too much" work compared to these two very simple commands:
XA_Load() and XA_Save().
That is all I need to do and I have ALL my variables available after one command, or the updated variables saved via one command.
But I don't think INI vs XML is an issue suitable/useful for discussion here or that it would impact usability of the script.
Unicode would be the biggest puzzle to solve, the rest is just window dressing ;-)

Edit: re ini-object this oINI library seems useful http://www.autohotkey.com/board/topic/71982-library-oini-ini-object/ ... will investigate further.
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2012-12-15, 10:58 UTC

Experimental branch with Unicode support for the Drag & Drop function, download the ZIP here https://github.com/hi5/F4MiniMenu/tree/UnicodeDD

Feedback welcome.

Also: Started experimenting with INI config but not satisfied with results yet.
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2013-03-30, 09:11 UTC

Update v0.5
- remove Unicode branch (wasn't working at all)
- added new Filelist support similar to the %L in button bar/start menu so you can pass on a file with the selected files to a program. Example usages are WinAmp (playlist) and XnView (view selected files in image browser)

More info and download (ZIP file) at https://github.com/hi5/F4MiniMenu
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2013-07-01, 16:13 UTC

Update v.06:
- Now works with AHK 1.1+ Unicode as well (drag & drop)
- Fixed listview icon issue

More info and download (ZIP file) at https://github.com/hi5/F4MiniMenu
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

User avatar
LonerD
Senior Member
Senior Member
Posts: 292
Joined: 2010-06-19, 20:18 UTC
Location: Donetsk

Post by *LonerD » 2013-10-22, 00:19 UTC

Bug command:
"Gui, Browse:Destroy"
F4MiniMenu can't work probably with it in TC 8.50 betas under Win8 x64 Eng
Total Commander DreamLair - dream always, think totally, be the commander of you own life.

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2013-10-22, 21:10 UTC

Thanks for the feedback, I don't have Win8 or 64bit but I'll try to prepare another version moving the Gui code around and avoiding Destroy but use Show & Hide. Might take a few weeks but I'll post link to GH branch here...

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2013-11-05, 18:46 UTC

@LonerD: I'm now running Win8.1 64bit Eng with TC 8.50beta7 (64 bit) and I can add, modify and remove editors without any problems. Can you tell me a bit more so I can try replicate the error? When you get the error messages, does it say in which include (settings.ahk or editors.ahk) or line the error occurs (Gui, Browse:Destroy is used in these two includes)

I'm running AHK 64bit (unicode) 1.1.13.01 and F4MiniMenu v0.61.

hi5
Member
Member
Posts: 157
Joined: 2012-11-03, 11:35 UTC
Contact:

Post by *hi5 » 2014-11-07, 23:50 UTC

F4MiniMenu - v0.8
Added F4 functions to Lister (grabbing the filename from the Window title) and the search results in the Find Files dialog.
Comment: if you use the Esc & Key as Foreground menu option it will fail as pressing Esc will close Lister and the Find Files dialog. The Winkey & Key combination does work - the menu will appear at the top of the window.
:arrow: Download the ZIP file https://github.com/hi5/F4MiniMenu (simply unpack and run) - don't forget to backup your F4MiniMenu.xml just to be sure.
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread

User avatar
LonerD
Senior Member
Senior Member
Posts: 292
Joined: 2010-06-19, 20:18 UTC
Location: Donetsk

Post by *LonerD » 2016-02-09, 20:16 UTC

Hi. Still only xml support?
Total Commander DreamLair - dream always, think totally, be the commander of you own life.

Post Reply