viewtopic.php?p=195040#p195040
Code: Select all
/*
******************************************************************************
@Author : Highend
@Modified: 2022-03-21
@Function: Copyto, moveto, backupto to the custom path list [operation as root]
@Version : v0.1w
******************************************************************************
*/
// Handle .ini file
$iniFile = self("path") . "\" . "INI" . "\" . "Copy to the custom path list [operation as root]" . ".ini";
// Write .ini file if missing
if (exists($iniFile) != 1) {
$iniContent = <<<'>>>'
//Path List
[mruQNS]
1="D:\Folder<:><:>D:\XYplorer<:><:>E:\Backups"
[RecentPath]
RecentPath=C:\
; The last query you've used
LastQuery=
>>>;
writefile($iniFile, $iniContent, , "tu");
}
// Get .ini file entries
$path = getkey("1", "mruQNS", "$iniFile");
$RecentPath = getkey("RecentPath", "RecentPath", "$iniFile");
}
}
//Replace...
$folders = formatlist(replace($path, "<:><:>", <crlf>), "e", <crlf>);
$folders2 = $folders;
// $c = gettoken($b, 1, <crlf>, "t");
//Scripting
$iconFolder = ":showfolders";
$iconCopy = ":copyto";
$iconMove = ":moveto";
$iconBackup = ":backupto";
$iconCfi = ":cfi";
$selectedItems = <get SelectedItemsPathNames |>;
$selectedItems2 = replace($selectedItems, "|", "<crlf>");
$count = get("CountSelected");
end (!$selectedItems), "No item(s) selected, aborted!";
$menu = "";
$indent = <space 4>;
$last = "";
$roots = "Copyto|moveto|backupto";
foreach($root, $roots, , "e") {
$tmpFolders = "$folders<crlf>Browse for destination folder<crlf><Edit Path List>";
switch (recase($root)) {
case "copyto" : $menu .= <crlf> . "Copy <selected items> here..." . "<:><:>" . $iconCopy; break;
case "moveto" : $menu .= <crlf> . "Move <selected items> here..." . "<:><:>" . $iconMove; break;
case "backupto": $menu .= <crlf> . "Backup <selected items> here..." . "<:><:>" . $iconBackup; break;
}
while ($tmpFolders) {
$tmpFolder = gettoken($tmpFolders, 1, <crlf>);
$tmpFolders = gettoken($tmpFolders, 2, <crlf>, , 2);
if ($tmpFolder != $last) {
$caption = gpc($tmpFolder, "component", -1);
}
$data = $root. " " . quote($tmpFolder) . ", " . quote($selectedItems) . ", , 2, 2;";
$menu .= <crlf> . $indent . $tmpFolder . "<:>" . $data . "<:>" . $iconFolder;
$last = $tmpFolder;
}
}
//Add Menu2
$menu2 = <crlf> . "$count list items are selected for the Copy|Move|Backup operation:" . "<:>" . "<:>" . $iconCfi;
$selection = popupnested("$menu<crlf><:>$menu2<crlf>$selectedItems2", 6:=<crlf>, 7:="<:>");
if ($selection) {
if(regexmatches("$selection", "list items are selected for")) {end 1==1};
//Edit Path List
if(regexmatches("$selection", "<Edit Path List>")) {
$text = input("Edit Path List", "Note: That the path cannot contain quotes", $folders2, "m", "cancel", 1500, 800);
if $text == "cancel" {end 1==1};
echo "Saved, Note: That the path cannot contain quotes";
$text = replace($text, <crlf>, "<:><:>");
setkey "$text", "1", "mruQNS", $iniFile; end 1==1;
}
//Browse Folder To Copy
if(regexmatches("$selection", "Copyto") && regexmatches("$selection", "Browse for destination folder")) {
$source = inputfolder($RecentPath, "Select Copy Destination<crlf>$count list items are selected for the Copy operation"); copyto $source, $selectedItems;
if(regexmatches($source, "\:")) {
setkey "$source", "RecentPath", "RecentPath", $iniFile; end 1==1;
}
}
//Browse Folder To Move
if(regexmatches("$selection", "Moveto") && regexmatches("$selection", "Browse for destination folder")) {
$source = inputfolder($RecentPath, "Select Move Destination<crlf>$count list items are selected for the Move operation"); moveto $source, $selectedItems;
if(regexmatches($source, "\:")) {
setkey "$source", "RecentPath", "RecentPath", $iniFile; end 1==1;
}
}
//Browse Folder To Backup
if(regexmatches("$selection", "Backupto") && regexmatches("$selection", "Browse for destination folder")) {
$source = inputfolder($RecentPath, "Select Backup Destination<crlf>$count list items are selected for the Backup operation"); backupto $source, $selectedItems;
if(regexmatches($source, "\:")) {
setkey "$source", "RecentPath", "RecentPath", $iniFile; end 1==1;
}
}
//Save Recent Path
if(regexmatches("$tmpFolder", "\:")) {
setkey "$tmpFolder", "RecentPath", "RecentPath", $iniFile; end 1==1;
}
load $selection, , "s";
}
Code: Select all
/*
******************************************************************************
@Author : Highend
@Modified: 2022-03-06
@Function: Copy to the custom path list [operation as root]
@Version : v0.1q2
******************************************************************************
*/
// Handle .ini file
$iniFile = self("path") . "\" . "INI" . "\" . "Copy to the custom path list [operation as root]" . ".ini";
// Write .ini file if missing
if (exists($iniFile) != 1) {
$iniContent = <<<'>>>'
//Path List
[mruQNS]
1="D:\Folder<:><:>D:\XYplorer<:><:>E:\Backups"
; The last query you've used
LastQuery=
>>>;
writefile($iniFile, $iniContent, , "tu");
}
// Get .ini file entries
$path = getkey("1", "mruQNS", "$iniFile");
}
}
//Replace...
$folders = formatlist(replace($path, "<:><:>", <crlf>), "e", <crlf>);
$folders2 = $folders;
// $c = gettoken($b, 1, <crlf>, "t");
//Scripting
$iconFolder = ":showfolders";
$iconCopy = ":copyto";
$iconMove = ":moveto";
$iconBackup = ":backupto";
$iconCfi = ":cfi";
$selectedItems = <get SelectedItemsPathNames |>;
$selectedItems2 = replace($selectedItems, "|", "<crlf>");
$count = get("CountSelected");
end (!$selectedItems), "No item(s) selected, aborted!";
$menu = "";
$indent = <space 4>;
$last = "";
$roots = "Copyto";
foreach($root, $roots, , "e") {
$tmpFolders = "$folders<crlf><Edit Path List>";
/*
switch (recase($root)) {
case "copyto" : $menu .= <crlf> . "Copy <selected items> here..." . "<:><:>" . $iconCopy; break;
case "moveto" : $menu .= <crlf> . "Move <selected items> here..." . "<:><:>" . $iconMove; break;
case "backupto": $menu .= <crlf> . "Backup <selected items> here..." . "<:><:>" . $iconBackup; break;
}
*/
while ($tmpFolders) {
$tmpFolder = gettoken($tmpFolders, 1, <crlf>);
$tmpFolders = gettoken($tmpFolders, 2, <crlf>, , 2);
if ($tmpFolder != $last) {
$caption = gpc($tmpFolder, "component", -1);
}
$data = $root. " " . quote($tmpFolder) . ", " . quote($selectedItems) . ", , 2, 2;";
$menu .= <crlf> . $tmpFolder . "<:>" . $data . "<:>" . $iconFolder;
$last = $tmpFolder;
}
}
//Add Menu2
$menu2 = <crlf> . "$count list items are selected for Copy operation:" . "<:>" . "<:>" . $iconCfi;
$selection = popupnested("$menu<crlf><:>$menu2<crlf>$selectedItems2", 6:=<crlf>, 7:="<:>");
if ($selection) {
if(regexmatches("$selection", "list items are selected for Copy operation")) {end 1==1};
//Edit Path List
if(regexmatches("$selection", "<Edit Path List>")) {
$text = input("Edit Path List", 'Note: That the path cannot contain quotes', $folders2, "m", "cancel", 1500, 800);
if $text == "cancel" {end 1==1};
echo "Saved, 'Note: That the path cannot contain quotes'";
$text = replace($text, <crlf>, "<:><:>");
setkey "$text", "1", "mruQNS", $iniFile; end 1==1;
}
load $selection, , "s";
}