F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Here you can propose new features, make suggestions etc.

Moderators: sheep, Hacker, Stefan2, white

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1618
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *DrShark »

By default TC uses Notepad as F4 editor.
In some cases it's not possible to change it.
F3 and F4 keys on some keyoards are small and/or placed in a way than it's easy to often mix them up (eapecially when it's dark) and press F4 by mistake where intention was to press F3.
Notepad is known for always trying to open the binary or just very big text files, and this opening may take a long time.

Suggestion:
also by default, when user presses F4, I suggest to show a splash screen similar to one TC shows in registered version on startup.
It should inform user that big or binary file is going to be opened Editor which may be slow.
While splash screen is opened and it, or main TC window, is in focus, the Esc key should close the splash screen and cancel opening the file in Editor.
It may have some big "X" button for closing using a mouse or touch.
If not closed by user, the splash screen should disappear in 2...3 seconds or so and then pass the file to the Editor.
Last edited by DrShark on 2020-09-05, 06:46 UTC, edited 1 time in total.
Android 4.3.1 no root, kernel 08.09.2016; Win7 Home Premium SP1 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right
User avatar
elgonzo
Power Member
Power Member
Posts: 516
Joined: 2013-09-04, 14:07 UTC

Re: F4 Editor: show temporary splash screen before which can cancel big or binary file opening with Notepad

Post by *elgonzo »

DrShark wrote:
2020-09-04, 14:14 UTC
Suggestion:
also by default, when user presses F4, I suggest to show a splash screen similar to one TC shows in registered version on startup.

If such a feature will make it into a future TC version, it should be disabled by default (a user should have to enable this explicitly, for example through an INI setting). We are not talking about an action and circumstances here that could have costly/damaging consequences, where a warning dialog that is enabled by default would be appropriate.

Users are free to change the editor to one of their choice. And they do. Very often they do. Because, the standard Notepad is rather limited.
(And no, the executable file name "notepad.exe" is not a reliable criteria for determining what kind of editor a user uses, because again, there are people who replace their notepad.exe. Just google for something like "windows replace notepad.exe" - plenty of search results.)

Many users don't suffer from the problem you describe. There is no reason for TC to try alerting by default all those users to a problem that doesn't exist for them, unless the intention really is to annoy a big portion of TC's user base. ;)
Windows 7 Pro x64 SP1
User avatar
Horst.Epp
Power Member
Power Member
Posts: 3840
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: F4 Editor: show temporary splash screen before which can cancel big or binary file opening with Notepad

Post by *Horst.Epp »

As elgonzo said
no need for such warning as default option.
Windows 10 Home x64 May 2020 Update, Version 2004 (OS Build 19041.508)
TC 9.51 x64 / x86, Everything 1.4.1.992 (x64)
User avatar
Dalai
Power Member
Power Member
Posts: 7269
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: F4 Editor: show temporary splash screen before which can cancel big or binary file opening with Notepad

Post by *Dalai »

If there is to be an option added to TC, I suggest to make it somewhat configurable depending on the size of the file that is to be opened. Perhaps defaulting this option to 0 which disables the prompt and leaves everything as is. But to be honest, I would go even further. I think it lies in the responsibility of the called program to show any warning or allow the user to skip loading large/huge files.

BTW, Notepad++ loads huge files much faster than Notepad. Even 350 MB video files only take a couple of seconds.

BTW2: It should be relatively easy to write a simple script (e.g. AutoHotkey, AutoIT) that acts as a wrapper which shows the warning/prompt if necessary and then calls the editor. Just to be clear, I'm not entirely against such a prompt and an option and my script suggestion is only meant to help in the meantime until TC gets such option.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups
User avatar
elgonzo
Power Member
Power Member
Posts: 516
Joined: 2013-09-04, 14:07 UTC

Re: F4 Editor: show temporary splash screen before which can cancel big or binary file opening with Notepad

Post by *elgonzo »

Dalai wrote:
2020-09-04, 20:44 UTC
BTW2: It should be relatively easy to write a simple script (e.g. AutoHotkey, AutoIT) that acts as a wrapper which shows the warning/prompt if necessary and then calls the editor. Just to be clear, I'm not entirely against such a prompt and an option and my script suggestion is only meant to help in the meantime until TC gets such option.
Using AutoHotkey or AutoIT can be an option. However, if corporate IT does not allow AHK/AutoIT (which is probably likely if they also deny installation of an individually user-chosen 3rd-party editor), there might still be the Powershell option (iirc, part of the Windows OS since Win7, but can also be installed on slightly older Windows versions). A Powershell script can utilize the classes and functionality offered by the .NET Framework, including the Winforms GUI toolkit. If one so desires and wants to spend the effort, such a file check + timed dialog can be done within a Powershell script without needing any 3rd-party tools. (But then again, nothing would stop corporate IT from disabling/stripping Powershell from the corporate PCs either, so...)
Windows 7 Pro x64 SP1
User avatar
DrShark
Power Member
Power Member
Posts: 1618
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *DrShark »

The only reason I'm requesting such warning to be enabled by default (and implementing it at all) is that Total Commander is already using Microsoft Notepad as a default F4 editor. If F4 editor wouldn't be defined by default (so TC could e.g. ask user to choose one on first try to open or create file with F4), many users would define other editors.
elgonzo wrote:
2020-09-04, 18:05 UTC
Because, the standard Notepad is rather limited.
The key problem with Notepad is not some of its missing features as a word processor, but that it may hang on try to open e.g. 1 Mb file, and then instead of continuing your work in TC you're going to Task Manager to kill Notepad... As I wrote, on some keyboards it's easy to press F4 instead of F3 by mistake, and it's not a best experience if on try to view a file in Lister and then close it instantly, you have a routine of looking at hanged Notepad and then killing it with a Task Manager.
elgonzo wrote:
2020-09-04, 18:05 UTC
There is no reason for TC to try alerting by default all those users to a problem that doesn't exist for them, unless the intention really is to annoy a big portion of TC's user base. ;)
[...]
(And no, the executable file name "notepad.exe" is not a reliable criteria for determining what kind of editor a user uses, because again, there are people who replace their notepad.exe. Just google for something like "windows replace notepad.exe" - plenty of search results.)
TC can check the author-related properties of Notepad.exe to determine whether it belongs to Microsoft and show such warning only for MS Notepad, and only for big and/or binary files.

Even if such warning would appear for any editor by default, why is it such a big deal? I suggested it to appear only for a moment, so user could notice that F4 was actually used on a file and react by pressing Esc (which is not that far from F4 and F3) to cancel an action. If you don't press Esc, editor will open your file.
Last edited by DrShark on 2020-09-05, 18:18 UTC, edited 1 time in total.
Android 4.3.1 no root, kernel 08.09.2016; Win7 Home Premium SP1 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right
User avatar
elgonzo
Power Member
Power Member
Posts: 516
Joined: 2013-09-04, 14:07 UTC

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *elgonzo »

DrShark wrote:
2020-09-05, 07:14 UTC
Even if such warning would appear for any editor by default, why it is such a big deal?
Why would it be such a big deal for those repeatedly affected by this issue to manually activate that warning? After all, they have a reason to prevent the issue, and they should be they ones being active in enabling the dialog.

You are talking like the issue at hand is a severe event with possibly severe consequences. Is it, though? Maybe i am mistaken but from what i can tell, the issue at hand is itself just an annoyance, not a critical/dangerous situation that possibly puts data at risk. It might be a workflow disruption, but this is highly dependent on the specifics of the workflow and cannot be generalized over the entire TC user base. So, why should those people being annoyed by that issue be a reason to annoy yet many more other TC users that are not affected by that specific annoying Notepad issue? I am sorry, but I don't follow you here.

If Ghisler finds ways to somewhat reliably detect whether "Notepad.exe" means standard Notepad.exe or is a stand-in for another editor (assuming he is going to implement such a dialog), then it would be fine, since the dialog wouldn't appear by default for every unaffected user. Or maybe just enable the dialog by default for new fresh installations, but not for existing installations -- this would also be fine, as it would not force the dialog upon every existing unaffected user, and disabling of the dialog would become just part of the initial configuration phase when starting to use TC. But "carpet-bombing" this dialog onto the entire TC user base, well, normally you don't need to jump into the fire to know that it will burn...
Windows 7 Pro x64 SP1
User avatar
Stefan2
Power Member
Power Member
Posts: 3013
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *Stefan2 »

DrShark wrote:
2020-09-04, 14:14 UTC
..
Suggestion:
also by default, when user presses F4, I suggest to show a splash screen similar to one TC shows in registered version on startup.
It should inform user that big or binary file is going to be opened Editor which may be slow.
....
instead of
Notepad.exe "%1"
you can call a script
myScript.ext "%1"
by F4 with such wanted feature.


For example simple batch with %~z, PowerShell or AutoHotkey or a VBScript:


Menu Configuration > Options... > Edit/View >> Editor for F4 ["F4wrapperSize.vbs" "%1"]

Code: Select all

REM https://ghisler.ch/board/viewtopic.php?p=392063#p392063
Set FSO = CreateObject("Scripting.FileSystemObject")
SET WSO = CreateObject("WScript.Shell")

If (Wscript.arguments.count < 1) Then WScript.Quit
myFile = Wscript.arguments.Item(0)

SET oFile = FSO.GetFile(myFile)
mySizeMB = Round(oFile.Size /1024 /1024,0)

If mySizeMB < 3 Then 
	'WSO.Run strCommand [,intWindowStyle 0=Hide 1=Activate 2=mini 3=maxi ...] [,bWaitTillFinish? True/False]
	WSO.Run "Notepad " &  myFile 
Else 
	msgbox "Sorry, " & mySizeMB & " MB is  too big"
End If



 Don't cry, write and wait, just do it.
User avatar
Ovg
Power Member
Power Member
Posts: 650
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *Ovg »

DrShark wrote:
2020-09-05, 07:14 UTC
Even if such warning would appear for any editor by default, why it is such a big deal?
May be someone don't want to see this trash message at all :?:
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.51 x64, Windows 7 SP1 x64
User avatar
Usher
Power Member
Power Member
Posts: 882
Joined: 2011-03-11, 10:11 UTC

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *Usher »

For me there may be a single option like F4WarnIfGreaterThan with default value 0 (=don't warn). Other possible values could be:
* -1 - warn always
* number - file size in bytes
* numberK (size in Kilobytes), numberM (siza in Megabytes) etc.
Regards from Poland
Andrzej P. Wozniak
User avatar
DrShark
Power Member
Power Member
Posts: 1618
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *DrShark »

Stefan2 wrote:
2020-09-05, 11:10 UTC
you can call a script [...] by F4 with such wanted feature.
Thank you for your script. However, replacing Notepad as F4 editor with such a scirpt/program has a disadvantage which is possible to avoid by possible native TC feature: from locations treated by TC as remote, e.g. FS Plugins, TC downloads the file to temporary location before passing it to defined F4 editor.
Natively, TC could start the download only if user won't press Esc in suggested warning. So user could save the time twice: on downloading and on unwanted opening in MS Notepad.
Android 4.3.1 no root, kernel 08.09.2016; Win7 Home Premium SP1 rus 32 bit
TC #149847 Personal licence

Cuz we're all in this together, We're here to make it right
User avatar
MVV
Power Member
Power Member
Posts: 8535
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *MVV »

I think such an option would be useful sometimes, I press F4 accidentally too (however my editor is able to handle large files). Perhaps TC could just show a message box with OK-Cancel buttons so Esc would cancel it, but there should also be a timer for that message box, and of course file size and delay should be configurable, and message box text can contain a hint how to get rid of it.

DrShark,
If you can't install or copy portable editor and often mix F3 and F4, maybe you can just change F4 to something more complicated, e.g. Win+F4?
User avatar
solid
Power Member
Power Member
Posts: 554
Joined: 2004-08-09, 11:20 UTC

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *solid »

Why don't just use some editor switcher like F4Menu, Choice editor, F4MiniMenu or something similar.
In that case you will have a chance to cancel opening of the file if you hit F4 by mistake. Also you can choose different program for opening, not necessarily Notepad as the only choice. Also configurable per filetype.
User avatar
Ovg
Power Member
Power Member
Posts: 650
Joined: 2014-01-06, 16:26 UTC
Location: MOW

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *Ovg »

2solid: :thumbsup: :thumbsup: :thumbsup:
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 9.51 x64, Windows 7 SP1 x64
hi5
Member
Member
Posts: 194
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: F4 Editor: show temporary splash screen which can cancel big or binary file before opening with Notepad

Post by *hi5 »

Similar discussion (with scripts/batch solutions) https://www.ghisler.ch/board/viewtopic.php?t=49231

I did think about it a while back, https://github.com/hi5/F4MiniMenu/issues/20 - I don't see the need myself but as you can simple select the editor you'd like to use...
F4MiniMenu - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey) - TC Forum thread
Post Reply