Multi Commander Support Forum
Multi Commander => Script => Topic started by: pncdaspropagandas on August 01, 2017, 18:46:30
-
In my PC, if I try to use the internal function to load file content to clipboard on a rather large file, MC hangs. So I created a script that decides when to use the built in function and when to use clip.exe
MC Script:
@var $focused_file = GetSourceFocusPath();
@var $focused_file_size = GetFileSize($focused_file);
@var $mcinstallpath = GetTagValue("${mcinstallpath}");
// MultiCommander doesn't support files bigger than ???KB, so we have to use window's clip.exe program
if ($focused_file_size > 307200)
{
//LogAppInfo('C:\Windows\System32\wscript.exe "' + $mcinstallpath ^ '\Tools\run_invisible\run_invisible_bat_1_arg.vbs" "' + $mcinstallpath ^ '\Tools\run_invisible\load_file_content_to_clipboard.bat" "' + $focused_file + '"');
MC.Run CMD={'C:\Windows\System32\wscript.exe'} ARG={'"' + $mcinstallpath ^ '\Tools\run_invisible\run_invisible_bat_1_arg.vbs" "' + $mcinstallpath ^ '\Tools\run_invisible\load_file_content_to_clipboard.bat" "' + $focused_file + '"'}
}
else
{
@var $focused_file_content = LoadStringFromFile($focused_file);
SetClipboardText($focused_file_content);
}
run_invisible_bat_1_arg.vbs
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
'MsgBox(WScript.Arguments(0))
WshShell.Run """" & WScript.Arguments(0) & """ """ & WScript.Arguments(1) & """",0,true
load_file_content_to_clipboard.bat
clip < %1
The reason to use a bat file instead of just running clip < %1 is that when you execute a command line with no visible cmd, the stdout doen't work.
-
That work for unicode data. but if the program that you paste into only reads the ascii clipboard it is not set. since there is some limit in a external lib. I can probably fix that with a workaround
-
True indeed!
-
Script function fixed in newest beta.. (2672+)
Also Menu > Tools > ToClipboard > File Content as Text
Is now enabled. (it was disabled before because of some crash issue.. now fixed)
-
:D :D :D