Page 1 of 1

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

Posted: 2020-09-04, 14:14 UTC
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.

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

Posted: 2020-09-04, 18:05 UTC
by gdpr deleted 6
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. ;)

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

Posted: 2020-09-04, 19:50 UTC
by Horst.Epp
As elgonzo said
no need for such warning as default option.

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

Posted: 2020-09-04, 20:44 UTC
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

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

Posted: 2020-09-04, 21:02 UTC
by gdpr deleted 6
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...)

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

Posted: 2020-09-05, 07:14 UTC
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 UTCBecause, 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 UTCThere 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.

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

Posted: 2020-09-05, 08:07 UTC
by gdpr deleted 6
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...

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

Posted: 2020-09-05, 11:10 UTC
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.

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

Posted: 2020-09-05, 11:41 UTC
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 :?:

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

Posted: 2020-09-05, 13:43 UTC
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.

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

Posted: 2020-09-05, 15:04 UTC
by DrShark
Stefan2 wrote: 2020-09-05, 11:10 UTCyou 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.

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

Posted: 2020-09-07, 05:41 UTC
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?

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

Posted: 2020-09-10, 14:07 UTC
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.

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

Posted: 2020-09-10, 15:31 UTC
by Ovg
2solid: :thumbsup: :thumbsup: :thumbsup:

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

Posted: 2020-09-16, 17:30 UTC
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...