Sometimes, by mistake, I press F4 instead of F3 or F5 key on a large file. Would be nice if TC first checks if the selected file is over some size (user defined value) before launching the editor. Ie if the file is greater than 20 MB, show a dialog window to warn the user.
Is there an option already in TC or is there any possibility to implement this option?
F4 - option to check the file size before editor is launched
Moderators: white, Hacker, petermad, Stefan2
Re: F4 - option to check the file size before editor is laun
No, there is no such option and its not on the file manager to do so.petrklic wrote:Sometimes, by mistake, I press F4 instead of F3 or F5 key on a large file. Would be nice if TC first checks if the selected file is over some size (user defined value) before launching the editor. Ie if the file is greater than 20 MB, show a dialog window to warn the user.
Is there an option already in TC or is there any possibility to implement this option?
Many editors give you a warning on opening large or binary files
PSpad for example.
Windows 11 Home x64 Version 23H2 (OS Build 22631.3527)
TC 11.03 x64 / x86
Everything 1.5.0.1374a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
TC 11.03 x64 / x86
Everything 1.5.0.1374a (x64), Everything Toolbar 1.3.3, Listary Pro 6.3.0.78
QAP 11.6.3.3 x64
petrklic,
You could use a simple script as your "editor" for F4 which would check the filesize and if it fits below the limit call the actual editor, example in AutoHotkey:
HTH
Roman
You could use a simple script as your "editor" for F4 which would check the filesize and if it fits below the limit call the actual editor, example in AutoHotkey:
Code: Select all
Editor = C:\Program Files\Editor\Editor.exe
FileSizeLimitInBytes = 10000000
FileGetSize, FileSize, % A_Args[1]
IfLessOrEqual, FileSize, %FileSizeLimitInBytes%
Run, % """" . Editor . """ """ . A_Args[1] . """"
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
No need for AutoHotKey or any other 3rd-party scripting solution.
A simple batch file like this should do:
Don't forget to replace the placeholders <MaxFileSizeInBytes> and <PathToEditorExecutable> with the respective values.
The batch file expects the file to open in the editor as (first) argument.
By the way, the message box opened by the "msg" command will auto-close after 60 seconds. I also do want to mention a rather minor annoyance of calling a batch file like this with F4 from TC: Whenever you press F4, for a very brief moment a console window will flash on your screen, which you might or might not notice and which you might or might not find annoying. If this is annoying to you, then you might want to use AutoHotKey or other tools that can avoid/suppress showing a (console) window when executing a script...
A simple batch file like this should do:
Code: Select all
@echo off
if %~z1 lss <MaxFileSizeInBytes> (
<PathToEditorExecutable> %1
) else (
msg %SessionName% File too large for editor
)
The batch file expects the file to open in the editor as (first) argument.
By the way, the message box opened by the "msg" command will auto-close after 60 seconds. I also do want to mention a rather minor annoyance of calling a batch file like this with F4 from TC: Whenever you press F4, for a very brief moment a console window will flash on your screen, which you might or might not notice and which you might or might not find annoying. If this is annoying to you, then you might want to use AutoHotKey or other tools that can avoid/suppress showing a (console) window when executing a script...