Page 1 of 1

Is it possible to have a static list of "Copy to" directories?

Posted: 04 Mar 2022 23:03
by zBernie
Is there a way to have a static list of directories for a "Copy to" button? The "Copy to Recent Locations" button provides a dynamic list which is constantly changing.

-Thanks

Re: Is it possible to have a static list of "Copy to" directories?

Posted: 04 Mar 2022 23:23
by highend
Write a script that displays a popupmenu with your desired entries and then copy your selection to the one you've clicked?

Re: Is it possible to have a static list of "Copy to" directories?

Posted: 05 Mar 2022 05:59
by zBernie
highend wrote: ↑04 Mar 2022 23:23 Write a script that displays a popupmenu with your desired entries and then copy your selection to the one you've clicked?
Can a custom be created which displays a list of items, similar to the "Copy to Recent Locations" button? If not I'll try your suggestion to create a popup menu.

-Thanks

Re: Is it possible to have a static list of "Copy to" directories?

Posted: 05 Mar 2022 06:38
by highend
You mean that the original window from the copy to button is used? No, that's not possible

Re: Is it possible to have a static list of "Copy to" directories?

Posted: 06 Mar 2022 01:12
by WirlyWirly
Most of the time, I too find myself copying/moving between a handful of directories. This seemed like a good idea, so I added it to my custom right-click menu script. Feel free to reference it if you decide to make your own Copy to menu...

Image

Code: Select all

/*
A collection of most-used right-click options

1 tab per submenu
DISPLAY|DATA (return value)|ICON|STATE

*/

    $menu = <<<MENU

0) Sort by...||<xyicons>\other\operations\sort.ico
    0) Date Modified|Sortby 'Modified', 'clk'|
    1) Size|Sortby 'Size', 'clk'|
    2) Extension|Sortby 'Ext', 'clk'|
    3) Date Created|Sortby 'Created', 'clk'|
    4) Name|Sortby 'Name', 'clk'|
    -
    Accessed|Sortby 'Accessed', 'clk'|
    Created|Sortby 'Created', 'clk'|
    Length|Sortby 'len', 'clk'|
    Path|Sortby 'Path', 'clk'|
    Random|#331|
    Type|Sortby 'Type', 'clk'|
    -
    Folders Apart|#333|

1) View..||<xyicons>\other\operations\view.ico
    0) Branch View|#311|:flatview
    1) List|#304|
    2) Thumbnails Medium|#307|
    3) Details|#302|
    -
    Details + Thumbnails|#303|
    Small Icons|#305|
    Large Icons|#309|
    Small Tiles|#313|
    Large Tiles|#314|
    Thumbnails Small|#306|
    Thumbnails Large|#308|

2) Open with...||<xyicons>\other\operations\open_with.ico
    1) BulkRename Utility|run lax("<xypath>..\..\Bulk Rename Utility\Bulk Rename Utility.exe" <selitems>)|"<xypath>..\..\Bulk Rename Utility\Bulk Rename Utility.exe"
    2) FileBot|run lax("<xypath>..\..\FileBot\filebot.launcher.exe" <selitems>)|"<xypath>..\..\FileBot\filebot.launcher.exe"
    3) IrfanView|run lax("<xypath>..\..\IrfanViewPortable\IrfanViewPortable.exe" <selitems>)|"<xypath>..\..\IrfanViewPortable\IrfanViewPortable.exe"
    4) MediaInfo|run lax("<xypath>..\..\MediaInfoPortable\MediaInfoPortable.exe" <selitems>)|"<xypath>..\..\MediaInfoPortable\MediaInfoPortable.exe"
    5) MP3Tag|run lax("<xypath>..\..\MP3Tag\Mp3Tag.exe" <selitems>)|"<xypath>..\..\MP3Tag\Mp3Tag.exe"
    6) MPC-BE|run lax("<xypath>..\..\MPC-BEPortable\MPC-BEPortable.exe" <selitems>)|"<xypath>..\..\MPC-BEPortable\MPC-BEPortable.exe"
    7) Notepad++|run lax("<xypath>..\..\Notepad++Portable\Notepad++Portable.exe" <selitems>)|"<xypath>..\..\Notepad++Portable\Notepad++Portable.exe"
    8) QBitTorrent|run lax("<xypath>..\..\QBittorrentPortable\QBittorrentPortable.exe" <selitems>)|"<xypath>..\..\QBittorrentPortable\QBittorrentPortable.exe"
    9) ShareX|run lax("<xypath>..\..\ShareX\ShareX.exe" <selitems>)|"<xypath>..\..\ShareX\ShareX.exe"
    -
    7-Zip|run lax("<xypath>..\..\7-ZipPortable\7-ZipPortable.exe" <selitems>)|"<xypath>..\..\7-ZipPortable\7-ZipPortable.exe"
    JavaPortable|run lax("<xypath>..\..\JavaPortableLauncher\JavaPortableLauncher.exe" <selitems>)|"<xypath>..\..\JavaPortableLauncher\JavaPortableLauncher.exe"
    GitBash|run lax("<xypath>..\..\GitPortable\Wrapper-GitBashPortable.exe" <selitems>)|"<xypath>..\..\GitPortable\Wrapper-GitBashPortable.exe"
    LibreOffice|run lax("<xypath>..\..\LibreOfficePortable\LibreOfficePortable.exe" <selitems>)|"<xyicons>\programs\libreoffice.ico"
    OniVim|run lax("<xypath>..\..\OniVim2\Oni2_editor.exe" <selitems>)|"<xypath>..\..\OniVim2\Oni2_editor.exe"
    Vim|run lax("<xypath>..\..\GitPortable\Wrapper-Vim.exe" <selitems>)|"<xypath>..\..\GitPortable\Wrapper-Vim.exe"
    VSCode|run lax("<xypath>..\..\VSCodePortapps\vscode-portable.exe" <selitems>)|"<xypath>..\..\VSCodePortapps\vscode-portable.exe"
    -
    Affinity Designer|run lax("C:\Program Files\Affinity\Designer\Designer.exe" <selitems>)|"C:\Program Files\Affinity\Designer\Designer.exe"
    Affinity Photo|run lax("C:\Program Files\Affinity\Photo\Photo.exe" <selitems>)|"C:\Program Files\Affinity\Photo\Photo.exe"
    Affinity Publisher|run lax("C:\Program Files\Affinity\Publisher\Publisher.exe" <selitems>)|"C:\Program Files\Affinity\Publisher\Publisher.exe"

3) Copy to...||"<xyicons>\other\operations\copy_to.ico"
    0) Downloads|copyto "%userreal%\Downloads\"|"%userreal%\Downloads\"
    1) Scratch|copyto "S:\Scratch"|"S:\Scratch\"
    2) Temp...||"<xyicons>\folders\default_folder.ico"
        0) Bayleef|copyto "B:\Temp\"|"B:\Temp\"
        1) Rhiley|copyto "R:\Temp\"|"R:\Temp\"
        2) Samantha|copyto "S:\Temp\"|"S:\Temp\"
    3) Transmission|copyto "S:\BitTorrent\Complete\"|"S:\BitTorrent\Complete\"

4) Move to...||"<xyicons>\other\operations\move_to.ico"
    0) Downloads|moveto "%userreal%\Downloads\"|"%userreal%\Downloads\"
    1) Scratch|moveto "S:\Scratch"|"S:\Scratch\"
    2) Temp...||"<xyicons>\folders\default_folder.ico"
        0) Bayleef|moveto "B:\Temp\"|"B:\Temp\"
        1) Rhiley|moveto "R:\Temp\"|"R:\Temp\"
        2) Samantha|moveto "S:\Temp\"|"S:\Temp\"
    3) Transmission|moveto "S:\BitTorrent\Complete\"|"S:\BitTorrent\Complete\"

5) Copy Filepath...||<xyicons>\other\operations\copy_filepath.ico
    0) Absolute path(s)|copytext lax(<selitems>);|
    1) Absolute Unix-style path(s)|$files = '"/' . '<selitems :::>' . '"'; $files = regexreplace($files, ':::', '" "/'); $files = regexreplace($files, '\\', '/'); $paths = regexreplace($files, ':'); copytext $paths
    -
    Item Name(s)|#102|
    Item Path(s)|#103|
    Item Stem(s)|#113|


6) Info...||<xyicons>\other\operations\info.ico
    0) File Properties|#173|
    1) Properties|#1020|
    2) Version|#1021|
    3) Meta|#1022|
    4) Preview|#1023|
    5) Raw View|#1024|
    6) Tags|#1025|
    7) Find Files|#1058|
    8) Report|#1059|


-
Task Manager|run "taskmgr.exe"|"<xyicons>\programs\taskmanager.ico"
-
7) Move Up|#1056|<xyicons>\other\operations\move_up.ico
8) Move to Other Pane|#803|:dpmoveto
9) Copy to Other Pane|#804|:dpcopyto

MENU;

    // Get X/Y position of a control
    $position = controlposition('TAB 1', 0);
    $x_pos = gettoken($position, 1, '|');
    $y_pos = gettoken($position, 2, '|');

    // Display the context menu
    $command = popupnested($menu, $x_pos, $y_pos,,,,,|);

    // Run the selected command or skip if it uses an id #
    if ($command) { load $command,, s; }
    /*if ($command && !regexmatches($command, '^\#\d+$')) { load $command,, s; }*/

Re: Is it possible to have a static list of "Copy to" directories?

Posted: 06 Mar 2022 13:30
by Norn
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";
	}