26
Support and Feedback / Re: Create URL shortcut?
« on: October 17, 2023, 19:03:07 »
URL shortcut to a file? Could you explain in details? It might be possible via MultiScript.
January 2024
MultiCommander v13.5 is released!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
@var $src_path = GetSourcePath();
@var $names = GetSourceItems();
@var $count = arrayCount( $names );
@var $i;
for( $i = 0; $i < $count; $i++ )
{
@var $file = $src_path ^ $names[ $i ];
@var $result = FileExists( $file );
if ( 1 == $result )
{
MC.Explorer.SetItemFocus ITEM="{$names[ $i ]}"
break;
}
}
I've created a password-protected *.7z archive via 7z File Manager (official GUI).
When I enter such archive and try to copy some file via F5, password dialog appears which shows entered symbols instead of "*"
@var $path = GetSourceFocusPath();
@var $new_name = GetSourcePath() ^ PathGetNamePart( $path, 1 ) + ".webp";
MC.Run CMD="D:\ImageMagick\convert.exe" ARG="${focusfilepath} ${new_name}";
@var $now = GetTime();
@var $date = FormatDate("dd-MM-yy" , $now);
@var $path = GetSourcePath() ^ $date;
MakeDir($path);
@var $now = GetTime();
@var $options[];
arrayAdd( $options, FormatDate("dd-MM-yy" , $now) );
arrayAdd( $options, FormatDate("dd-MM-yyyy" , $now) );
arrayAdd( $options, FormatDate("yyyy_MM_dd" , $now) );
arrayAdd( $options, FormatDate("ddd MMM yyyy" , $now) );
@var $o = AskOption( "Make new dir: select date format", $options, 0 );
if( $o > -1 )
{
@var $path = GetSourcePath() ^ $options[$o];
MakeDir($path);
}
What do I have to put in "Find" and "Replase with" so that everything disappears behind the first "["?
Is Option 2 really needed ? if you enter many delimiters . dont you always want it to split at the position where any of the delimiters are found ? (option 1 ?)
1)
When you have selected several files, and using the windows hotkeys, pressing f2 should open the multirenamer windows, with those files already loaded.
So you mean if you set target name like CopyFile ("C:\NewFile.txt" , C:\MyFile.txt" , "NODIALOG, OVERWRITE_ALL" );
It does not work ?
# Error "Source and Target file are the same. Cannot copy a file to itself"
# (err.png)
@var $res = CopyFile("d:\\temp\\abc.txt", "d:\\temp\\1.txt", "NODIALOG")
# $res = 1, but file is not copied
$res = CopyFile("d:\temp\abc.txt", "d:\temp\1.txt", "NODIALOG")
# Shows copy dialog with wrong destination path (err2.png),
# but produce no error, file is not copied
$res = CopyFile("d:\temp\abc.txt", "d:\temp\1.txt")
@var $str = "123,|456;|,789";
@var $arr = StrSplit($str, ";|,");
# parse csv S&R file
function ParseCSV($file, $separators, $quote_chars)
{
if ( !(StrLen($separators) == 1) )
{
$separators = ",";
}
if ( StrLen($quote_chars) == 0 )
{
$quote_chars = "\"";
}
@var $reg_ex = "^([" + $quote_chars + "])(.*)\\1$";
@var $lines = LoadArray($file);
@var $lines_cnt = arrayCount($lines);
# single-string multiline S&R patterns
# $pattern[0] - search pattern, $pattern[1] - replace pattern
@var $pattern[2] = {"", ""};
@var $i;
for ($i = 0; $i < $lines_cnt; $i++)
{
# $pair[0] - search pattern, $pair[1] - replace pattern
@var $pair = StrSplit($lines[$i], $separators);
# invalid line
if ( !(arrayCount($pair) == 2) )
{
continue;
}
# append unquoted patterns
$pattern[0] = $pattern[0] + StrRegExpReplace( $pair[0], $reg_ex, "$2" ) + "\n";
$pattern[1] = $pattern[1] + StrRegExpReplace( $pair[1], $reg_ex, "$2" ) + "\n";
}
return $pattern;
}
###
@var $sar_file = GetTargetFocusPath();
@var $sar_pattern = ParseCSV($sar_file, ";", "\"`");
if ( ( StrLen($sar_pattern[0]) * StrLen($sar_pattern[1]) ) > 0 )
{
@var $sel_files = GetSourceSelectedPaths();
@var $sel_count = arrayCount($sel_files);
@var $n;
for($n = 0; $n < $sel_count; $n++)
{
@var $file = $sel_files[$n];
@var $new_file = "*_new.*";
MC.Utils.FindAndReplace MODE="Many" FIND={$sar_pattern[0]} REPLACEWITH={$sar_pattern[1]} FILE="{$file}" TARGET="{$new_file}" SILENT REPLACEALL OVERWRITE
}
}
@var $sel_files = GetSourceSelectedPaths();
@var $sel_count = arrayCount($sel_files);
@var $find_text = "aaa\\nbbb";
@var $repl_text = "xxx\\nyyy";
@var $n;
for($n = 0; $n < $sel_count; $n++)
{
@var $file = $sel_files[$n];
# @var $new_file = PathGetPathPart($file) ^ PathGetNamePart($file, 1) + "_new" + PathGetFileExtPart($file);
@var $new_file = "*_new.*";
MC.Utils.FindAndReplace MODE="Many" FIND={$find_text} REPLACEWITH={$repl_text} FILE="{$file}" TARGET="{$new_file}" SILENT REPLACEALL OVERWRITE
}
MC.Utils.FindAndReplace REPLACEALL MODE="Many" FIND="fff\nddd" REPLACEWITH="zzz\naaa" FILE="d:\\temp\\1.txt" TARGET="*_new.*" SILENT OVERWRITE
How do you cancel dragging?