Page 1 of 1
CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 15:41
by Jerry
Hi all,
Just sharing this simple script I have been using with great satisfaction. It lets you work with a preset menu of paths that you frequently access and gives you a choice of operations: Go to, Copy or Move. In the latter 2 cases, the operation will work on any items you select in the List. The script has an example menu of paths with separators and a sub menu.
Before I created this script, I was using the Favorite Folders and Recent File Operations menus. But the Recent File Operations menu is dynamically created from the Action log and common paths I use wouldn't necessarily stay there. And Favorite Folders is often slow to popup on my system because most of the paths I use are on external drives which might be asleep. (Don had made improvements to address this, but it's still problematic for me.) Recent File Operations can also be slow to popup sometimes too.
Code: Select all
// This script pops up a menu of destinations and actions (Move, Copy or Go To),
// then performs the chosen operation for the chosen destination
// using selected items if relevant.
// [Created by XYplorer forum Jerry]
//==================================================================
// Define your preset destinations here:
$destinations = <<<#---MENU_END
Downloads
Documents
Desktop
-
Windows System Folders
%appdata%
%localappdata%
%temp%
%programfiles%
%programfiles(x86)%
#---MENU_END;
//==================================================================
// Check for selected items
$selcount = gettoken(<selitems |>, "count", "|");
// Ask for Action
$action = popupmenu("Go To|Copy|Move");
if ($action == "") { end 1; } // user cancelled
if ($action == "Go To") {
$selcountDisplay = ""
} else {
$selcountDisplay = " (" . $selcount . " items)"
}
// Require selected items if necessary
if ($action != "Go To") {
if ($selcount == 0) {
msg "You must select one or more items for the chosen operation ($action).";
end 1==1;
}
}
// Build menu of destination names, include the $action with item count as a disabled header
$menu = recase($action, "upper") . $selcountDisplay . ";;;4<crlf>-<crlf>" . $destinations;
// Show menu of destinations
$choice = popupnested($menu);
if ($choice == "") { end 1; } // user cancelled
$dest = trim($choice);
if ($action == "Go To") {
goto $dest;
end 1==1;
}
// Perform the operation on selected items
if ($action == "Move") {
moveto $dest, <get SelectedItemsPathNames |>;
} elseif ($action == "Copy") {
copyto $dest, <get SelectedItemsPathNames |>;
}
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 16:26
by noembryo
Very useful, thank you for this

One improvement I would like to see, is a way to be able to display a title instead of the full path.
E.g. Photos instead of D:\In\Data\PhotoEDITS.
Either way, very helpful script..

Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 16:38
by Jerry
noembryo wrote: ↑20 Dec 2025 16:26
One improvement I would like to see, is a way to be able to display a title instead of the full path.
E.g. Photos instead of D:\In\Data\PhotoEDITS.
Thank you! Yes, you can display a caption instead of the full path. See the change below with the Windows System Folder submenu:
Code: Select all
// This script pops up a menu of destinations and actions (Move, Copy or Go To),
// then performs the chosen operation for the chosen destination
// using selected items if relevant.
// [Created by XYplorer forum Jerry]
//==================================================================
// Define your preset destinations here:
$destinations = <<<#---MENU_END
Downloads
Documents
Desktop
-
Windows System Folders
AppData (Roaming);%appdata%
AppData (Local);%localappdata%
Temp;%temp%
Program Files (64bit);%programfiles%
Program Files (32bit);%programfiles(x86)%
#---MENU_END;
//==================================================================
// Check for selected items
$selcount = gettoken(<selitems |>, "count", "|");
// Ask for Action
$action = popupmenu("Go To|Copy|Move");
if ($action == "") { end 1; } // user cancelled
if ($action == "Go To") {
$selcountDisplay = ""
} else {
$selcountDisplay = " (" . $selcount . " items)"
}
// Require selected items if necessary
if ($action != "Go To") {
if ($selcount == 0) {
msg "You must select one or more items for the chosen operation ($action).";
end 1==1;
}
}
// Build menu of destination names, include the $action with item count as a disabled header
$menu = recase($action, "upper") . $selcountDisplay . ";;;4<crlf>-<crlf>" . $destinations;
// Show menu of destinations
$choice = popupnested($menu);
if ($choice == "") { end 1; } // user cancelled
$dest = trim($choice);
if ($action == "Go To") {
goto $dest;
end 1==1;
}
// Perform the operation on selected items
if ($action == "Move") {
moveto $dest, <get SelectedItemsPathNames |>;
} elseif ($action == "Copy") {
copyto $dest, <get SelectedItemsPathNames |>;
}
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 16:45
by highend
Do NOT use a ; as a delimiter, use e.g. |
Why? Paths can contain a semicolon themselves...
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 16:55
by Jerry
highend wrote: ↑20 Dec 2025 16:45
Do NOT use a
; as a delimiter, use e.g.
|
Why? Paths can contain a semicolon themselves...
Yes, that was my first choice too, but it doesn't work, at least with the heredoc form of the string. See image and code below. You just get the whole line with the pipe included.
Code: Select all
// This script pops up a menu of destinations and actions (Move, Copy or Go To),
// then performs the chosen operation for the chosen destination
// using selected items if relevant.
// [Created by XYplorer forum Jerry]
//==================================================================
// Define your preset destinations here:
$destinations = <<<#---MENU_END
Downloads
Documents
Desktop
-
Windows System Folders
AppData (Roaming)|%appdata%
AppData (Local)|%localappdata%
Temp|%temp%
Program Files (64bit)|%programfiles%
Program Files (32bit)|%programfiles(x86)%
#---MENU_END;
//==================================================================
// Check for selected items
$selcount = gettoken(<selitems |>, "count", "|");
// Ask for Action
$action = popupmenu("Go To|Copy|Move");
if ($action == "") { end 1; } // user cancelled
if ($action == "Go To") {
$selcountDisplay = ""
} else {
// Require selected items if necessary for the action
if ($selcount == 0) {
msg "You must select one or more items for the chosen operation ($action).";
end 1==1;
}
$selcountDisplay = " (" . $selcount . " items)"
}
// Build menu of destination names, include the $action with item count as a disabled header
$menu = recase($action, "upper") . $selcountDisplay . ";;;4<crlf>-<crlf>" . $destinations;
// Show menu of destinations
$choice = popupnested($menu);
if ($choice == "") { end 1; } // user cancelled
$dest = trim($choice);
if ($action == "Go To") {
goto $dest;
end 1==1;
}
// Perform the operation on selected items
if ($action == "Move") {
moveto $dest, <get SelectedItemsPathNames |>;
} elseif ($action == "Copy") {
copyto $dest, <get SelectedItemsPathNames |>;
}
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 17:32
by highend
Ofc this works...
Code: Select all
// This script pops up a menu of destinations and actions (Move, Copy or Go To),
// then performs the chosen operation for the chosen destination
// using selected items if relevant.
// [Created by XYplorer forum Jerry]
//==================================================================
// Define your preset destinations here:
$destinations = <<<#---MENU_END
Downloads
Documents
Desktop
-
Windows System Folders
AppData (Roaming)|%appdata%
AppData (Local)|%localappdata%
Temp|%temp%
Program Files (64bit)|%programfiles%
Program Files (32bit)|%programfiles(x86)%
#---MENU_END;
//==================================================================
// Check for selected items
$selcount = gettoken(<selitems |>, "count", "|");
// Ask for Action
$action = popupmenu("Go To|Copy|Move");
if ($action == "") { end 1; } // user cancelled
if ($action == "Go To") {
$selcountDisplay = ""
} else {
// Require selected items if necessary for the action
if ($selcount == 0) {
msg "You must select one or more items for the chosen operation ($action).";
end 1==1;
}
$selcountDisplay = " (" . $selcount . " items)"
}
// Build menu of destination names, include the $action with item count as a disabled header
$menu = recase($action, "upper") . $selcountDisplay . "|||4<crlf>-<crlf>" . $destinations;
// Show menu of destinations
$choice = popupnested($menu, 6:=<crlf>, 7:="|");
if ($choice == "") { end 1; } // user cancelled
$dest = trim($choice);
if ($action == "Go To") {
goto $dest;
end 1==1;
}
// Perform the operation on selected items
if ($action == "Move") {
moveto $dest, <get SelectedItemsPathNames |>;
} elseif ($action == "Copy") {
// copyto $dest, <get SelectedItemsPathNames |>;
}
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 17:56
by noembryo
It works!
And since we're on the roll, can we have an option to open the goto target in another tab, like middle clicking or ctrl+click?
(You may be fast, but I'm faster..

)
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 17:57
by Jerry
Ah, ok. You have to also pass in "|" as the non-default item separator in the call to popupnested:
Code: Select all
$choice = popupnested($menu, 6:=<crlf>, 7:="|");
Didn't know you can pass arguments with the index keyword like that. Good to know.
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 18:01
by Jerry
noembryo wrote: ↑20 Dec 2025 17:56
And since we're on the roll, can we have an option to open the goto target in another tab, like middle clicking or ctrl+click?
Have to let highend answer that one. I don't see any possible Custom Event Actions for popup menu items in Configuration.
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 18:12
by noembryo
Jerry wrote: ↑20 Dec 2025 18:01
noembryo wrote: ↑20 Dec 2025 17:56
And since we're on the roll, can we have an option to open the goto target in another tab, like middle clicking or ctrl+click?
Have to let highend answer that one. I don't see any possible Custom Event Actions for popup menu items in Configuration.
Not a big deal, never mind.
I just had to try..

Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 18:30
by Jerry
Actually, this works. Just add another operation for Go To (new tab). And you can modify or add to this similarly for new background tab, tab in other pane, etc.
Code: Select all
// This script pops up a menu of destinations and actions (Move, Copy or Go To),
// then performs the chosen operation for the chosen destination
// using selected items if relevant.
// [Created by XYplorer forum Jerry]
//==================================================================
// Define your preset destinations here:
$destinations = <<<#---MENU_END
Downloads
Documents
Desktop
-
Windows System Folders
AppData (Roaming)|%appdata%
AppData (Local)|%localappdata%
Temp|%temp%
Program Files (64bit)|%programfiles%
Program Files (32bit)|%programfiles(x86)%
#---MENU_END;
//==================================================================
// Check for selected items
$selcount = gettoken(<selitems |>, "count", "|");
// Ask for Action
$action = popupmenu("Go To|Go To (new tab)|Copy|Move");
if ($action == "") { end 1; } // user cancelled
if (substr($action, 0, 5) == "Go To") {
$selcountDisplay = ""
} else {
// Require selected items if necessary for the action
if ($selcount == 0) {
msg "You must select one or more items for the chosen operation ($action).";
end 1==1;
}
$selcountDisplay = " (" . $selcount . " items)"
}
// Build menu of destination names, include the $action with item count as a disabled header
$menu = recase($action, "upper") . $selcountDisplay . "|||4<crlf>-<crlf>" . $destinations;
// Show menu of destinations
$choice = popupnested($menu, 6:=<crlf>, 7:="|");
if ($choice == "") { end 1; } // user cancelled
$dest = trim($choice);
if ($action == "Go To") {
goto $dest;
end 1==1;
} elseif ($action == "Go To (new tab)") {
tab("new", $dest);
end 1==1;
}
// Perform the operation on selected items
if ($action == "Move") {
moveto $dest, <get SelectedItemsPathNames |>;
} elseif ($action == "Copy") {
copyto $dest, <get SelectedItemsPathNames |>;
}
Re: CommonPathsAndOperations.xys - Goto/Copy/Move to common destinations
Posted: 20 Dec 2025 20:18
by noembryo
Nice
