Hello,
I am using "File | Duplicate | Move Here to New Subfolder..." for a lot of files, sometimes hundreds in one folder. This works well, but when I select a few files and choose this option (using a user button), I lose my place among the hundreds of files because the focus jumps to the newly created folder, always at/near the top of the list. Is there a way I can use this function but keep my place in the file list each time?
Thank you
Keep position after move to subfolder
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Keep position after move to subfolder
You could. By adding additional script lines (get the file before the first selected, ID of the command, select that file, scroll it into view).
But before doing that, copying the way it works as a script seems a lot easier...
But before doing that, copying the way it works as a script seems a lot easier...
Code: Select all
$items = <get SelectedItemsNames <crlf>>;
end (!$items), "No item(s) selected, aborted!";
$fstItem = gettoken($items, 1, <crlf>);
$fldName = input("Move Here to New Subfolder", "Select or enter folder name or subpath.", gpc($fstItem, "base"));
end (trim($fldName) == ""), "No subfolder name given, aborted!";
moveto "<curpath>\$fldName", $items, , 2, 2;
One of my scripts helped you out? Please donate via Paypal
-
reebae
- Posts: 17
- Joined: 12 Aug 2020 13:57
Re: Keep position after move to subfolder
Thank you very much. This script works well.
I notice one difference between this and the #1041 command -- it doesn't prompt me upon subfolder name collisions (Subfolder 'xyz' already exists). Honestly, it saves me a click/time so it's not a bad thing, but is there an option to check for an existing folder of the same name? I'm willing to create another button that gives this prompt if necessary (as opposed to a submenu prompt). Sometimes I need to be careful and not create many unnecessary folders with slightly different names, so prompts are helpful.
I notice one difference between this and the #1041 command -- it doesn't prompt me upon subfolder name collisions (Subfolder 'xyz' already exists). Honestly, it saves me a click/time so it's not a bad thing, but is there an option to check for an existing folder of the same name? I'm willing to create another button that gives this prompt if necessary (as opposed to a submenu prompt). Sometimes I need to be careful and not create many unnecessary folders with slightly different names, so prompts are helpful.
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Keep position after move to subfolder
Code: Select all
$items = <get SelectedItemsNames <crlf>>;
end (!$items), "No item(s) selected, aborted!";
$fstBase = gpc(gettoken($items, 1, <crlf>), "base");
$fldName = input("Move Here to New Subfolder", "Select or enter folder name or subpath.", $fstBase);
end (trim($fldName) == ""), "No subfolder name given, aborted!";
$dstPath = "<curpath>\$fldName";
if (exists($dstPath) == 2) {
if (confirm("Subfolder '" . $fldName . "' already exists.<br><br>Do you still want to move the selected items here?")) {
moveto $dstPath, $items, , 2, 2;
}
} else {
moveto $dstPath, $items, , 2, 2;
}
One of my scripts helped you out? Please donate via Paypal
-
reebae
- Posts: 17
- Joined: 12 Aug 2020 13:57
Re: Keep position after move to subfolder
This is exactly what I needed. Thank you for the script and your help.
XYplorer Beta Club