Insert option for rename
Posted: 06 Nov 2018 12:15
Because some files require inserting text at certain position.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
$notes = <<<>>>
Usage: <position>|<text>
If "<position>|" is left out, <text> is appended (before any extension)
<position> = 0: Insert at the beginning
Any other number than 0: Insert at that position
>>>;
$default = "0|";
$text = input("Insert text", $notes, $default, "s", , 250, 150);
if (regexmatches($text, "^\d+\|")) {
$position = gettoken($text, 1, "|");
$text = gettoken($text, 2, "|");
} else {
if (exists(<curitem>) == 2) { $position = strlen(<curname>); }
else { $position = strlen(<curbase>); }
}
renameitem(substr(<curname>, 0, $position) . $text . substr(<curname>, $position));