Hi!
Is there a way to emulate the "SendTo" functionality inside XYplorer?
Use: A specific user button matched to a selected batch file, or anything that could
already be in the sendTo folder.
Example:
Let's say that I put a file named "drophere.bat" on the Windows SendTo folder.
It does some stuff I want on dropped file(s) and/or folder(s).
Then, in Explorer, when I select a few files and right click on them, the "Send To"
menu appears, and I have the option to send them to "drophere.bat". (The "Send To"
menu also appears if the files are from different folders but they were found using
the Windows Explorer "find files" functionality.)
How to do the same thing in XYplorer? i.e. Select a bunch of file(s) and/or folder(s)
and instead of right clicking and "Send to", just drag them over to a user button
pointing straight to the "drophere.bat" file.
Additional info:
I noticed that XYplorer does not support right clicking and "Send To" when the
selected files and folders come from the XYplorer's "find files" functionality AND they
reside on different parent folders. However, if you manage to implement the above
functionality (batch file as a user button - or any file to that matter), that could be
a workaround.
Thanks a lot!
Emulate SendTo folder as a user button
Re: Emulate SendTo folder as a user button
Name field in the CTB:
%APPDATA%\Microsoft\Windows\SendTo\drophere.bat
Drawback? .bat file is executed for each file separately.
This as a script instead should do it:
AllowMultiLocShellMenu=1
%APPDATA%\Microsoft\Windows\SendTo\drophere.bat
Drawback? .bat file is executed for each file separately.
This as a script instead should do it:
Code: Select all
openwith "%APPDATA%\Microsoft\Windows\SendTo\drophere.bat", "s", <selitems |>;
Try this tweak:I noticed that XYplorer does not support right clicking and "Send To" when the
selected files and folders come from the XYplorer's "find files" functionality AND they
reside on different parent folders.
AllowMultiLocShellMenu=1
One of my scripts helped you out? Please donate via Paypal
Re: Emulate SendTo folder as a user button
Kindly thank your for your help...
This is probably working with plain batch files, but I have something more complicated:
It's a Cygwin bsh file.
The bsh file has the following shell, in order to be drag'n'droppable:
[HKEY_CURRENT_USER\Software\Classes\Bash Shell Script\shell\open\command]
@="\"C:\\cygwin\\bin\\mintty.exe\" -i /Cygwin-Terminal.ico C:\\cygwin\\bin\\bash.exe -l -c \"cd $(dirname \\\"$(cygpath -u \\\"%1\\\")\\\") ; $(cygpath -u \\\"%1\\\") $(cygpath -u \\\"%*\\\") ; \""
(%1 is the path of the bsh file and %* are the files/folders)
Let's say that the contents of drophere.bsh are the following:
echo "$0"
echo "$1"
echo "$2"
echo "$3"
echo "$4"
read -p "Press any key to continue... " -n1 -s ; exit
And the relevant files are the following:
%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh <---- the bsh file
D:\Temp\1\LLLregular.txt <------ the first file (simple)
D:\Temp\2\RRR Περίεργο αρχείο.txt <--------- the second file (contains spaces and greek letters on the filename)
So when anything is sent there by Windows Explorer (regardless of variable parent folders), it works ok.
For example the output is:
/cygdrive/c/Users/user/AppData/Roaming/Microsoft/Windows/SendTo/LLLtest.bsh
/cygdrive/d/Temp/1/LLLREG~1.TXT
D:/Temp/2/RRR~1.TXT
But in XYplorer:
1) Name field in the CTB: %APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh (nothing else on Icon and on left clicks or right clicks)
Also doesn't support dropping the two files on the CTB, only selecting them and clicking the ctb
Output:
cygpath: can't convert empty path
/cygdrive/c/Users/user/AppData/Roaming/Microsoft/Windows/SendTo/LLLtest.bsh
[the two files are missing]
2) Everything empty on the CTB, except the left click: openwith "%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh", "s", <selitems |>;
or
openwith "%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh", "s", "<selitems |>";
Doesn't work at all. Black screen and exit without any prompts.
3) AllowMultiLocShellMenu=1
Doesn't work at all. Black screen and exit without any prompts.
So, perhaps your 3 suggestions may work with something less complicated, but not with what I have to work with.
As a workaround, perhaps I should edit the shell open command to be more friendly to your suggestions.
What DOES work is this: I just have a windows explorer open showing the file:
%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh
then, I drag and drop the found files/folders from xyplorer there and it works ok.
I will do some more testing and I may get back to you. In any case, thanks for your time and effort!
This is probably working with plain batch files, but I have something more complicated:
It's a Cygwin bsh file.
The bsh file has the following shell, in order to be drag'n'droppable:
[HKEY_CURRENT_USER\Software\Classes\Bash Shell Script\shell\open\command]
@="\"C:\\cygwin\\bin\\mintty.exe\" -i /Cygwin-Terminal.ico C:\\cygwin\\bin\\bash.exe -l -c \"cd $(dirname \\\"$(cygpath -u \\\"%1\\\")\\\") ; $(cygpath -u \\\"%1\\\") $(cygpath -u \\\"%*\\\") ; \""
(%1 is the path of the bsh file and %* are the files/folders)
Let's say that the contents of drophere.bsh are the following:
echo "$0"
echo "$1"
echo "$2"
echo "$3"
echo "$4"
read -p "Press any key to continue... " -n1 -s ; exit
And the relevant files are the following:
%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh <---- the bsh file
D:\Temp\1\LLLregular.txt <------ the first file (simple)
D:\Temp\2\RRR Περίεργο αρχείο.txt <--------- the second file (contains spaces and greek letters on the filename)
So when anything is sent there by Windows Explorer (regardless of variable parent folders), it works ok.
For example the output is:
/cygdrive/c/Users/user/AppData/Roaming/Microsoft/Windows/SendTo/LLLtest.bsh
/cygdrive/d/Temp/1/LLLREG~1.TXT
D:/Temp/2/RRR~1.TXT
But in XYplorer:
1) Name field in the CTB: %APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh (nothing else on Icon and on left clicks or right clicks)
Also doesn't support dropping the two files on the CTB, only selecting them and clicking the ctb
Output:
cygpath: can't convert empty path
/cygdrive/c/Users/user/AppData/Roaming/Microsoft/Windows/SendTo/LLLtest.bsh
[the two files are missing]
2) Everything empty on the CTB, except the left click: openwith "%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh", "s", <selitems |>;
or
openwith "%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh", "s", "<selitems |>";
Doesn't work at all. Black screen and exit without any prompts.
3) AllowMultiLocShellMenu=1
Doesn't work at all. Black screen and exit without any prompts.
So, perhaps your 3 suggestions may work with something less complicated, but not with what I have to work with.
As a workaround, perhaps I should edit the shell open command to be more friendly to your suggestions.
What DOES work is this: I just have a windows explorer open showing the file:
%APPDATA%\Microsoft\Windows\SendTo\LLLtest.bsh
then, I drag and drop the found files/folders from xyplorer there and it works ok.
I will do some more testing and I may get back to you. In any case, thanks for your time and effort!
Re: Emulate SendTo folder as a user button
Maybe you should have said that in the first place... Sorry, I won't install Cygwin here to testThis is probably working with plain batch files, but I have something more complicated:
It's a Cygwin bsh file.
that kind of setup. No time for this
What I posted works fine (here) with a .bat file as the destination
Em? This is a tweak for XYplorer's .ini file, look at the quote above in my related posting please3) AllowMultiLocShellMenu=1
Doesn't work at all. Black screen and exit without any prompts.
One of my scripts helped you out? Please donate via Paypal
Re: Emulate SendTo folder as a user button
True, it's a hassle. If I come up with an answer, I will post it here... Thank you!
Re: Emulate SendTo folder as a user button
A workaround may be to just recreate your bsh shell commands (the REG entry above) as a bat file, and use the previous solution, so the bat file is an intermediate, not that I have tested this, and it's probably not the solution you are looking for, personally I would use PFA instead.
Also for instructions on how to tweak, in case you were wondering:
https://www.xyplorer.com/faq-topic.php?id=tweak
Also for instructions on how to tweak, in case you were wondering:
https://www.xyplorer.com/faq-topic.php?id=tweak
Re: Emulate SendTo folder as a user button
Hi, this is what I did and it suits me:
XYplorer script
"Prepare sync"
end(getinfo("CountSelected") < 1), "Please select some files first.";
$Records = replace(report("{Fullname}<crlf>",1), "\", "/");
writefile("c:\cygwin\tmp\mytmplist.txt", $Records,,utf8);
status "mytmplist created";
run "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico C:\cygwin\bin\bash.exe -l -c ~/mybashscript.bsh", ,0;
status "Just run bsh";
}
... and the mybashscript.bsh handles everything else (parses the mytmplist.txt and does its magic - all ok)...
Thanks, you guys, for the help...
XYplorer script
"Prepare sync"
end(getinfo("CountSelected") < 1), "Please select some files first.";
$Records = replace(report("{Fullname}<crlf>",1), "\", "/");
writefile("c:\cygwin\tmp\mytmplist.txt", $Records,,utf8);
status "mytmplist created";
run "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico C:\cygwin\bin\bash.exe -l -c ~/mybashscript.bsh", ,0;
status "Just run bsh";
}
... and the mybashscript.bsh handles everything else (parses the mytmplist.txt and does its magic - all ok)...
Thanks, you guys, for the help...
Re: Emulate SendTo folder as a user button
Glad you got it working and sound happy, I noticed in the first post you sounded like you wanted to be able to drop files on the button too, if that is still the case you could adapt your script to accept both ways, something like this:
Also I noticed that you are missing quotes around utf8 in your script.
Code: Select all
$Records = <get drop> ? <get drop> : <selitems <crlf>>;
end(!$Records, "Please select or drop some files first.");
writefile("c:\cygwin\tmp\mytmplist.txt", replace($Records, "\", "/"), , "utf8");
status "mytmplist created";
run "C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico C:\cygwin\bin\bash.exe -l -c ~/mybashscript.bsh", ,0;
status "Just run bsh";
Re: Emulate SendTo folder as a user button
Actually, my script also works two ways (drag and dropping or just clicking the button with files selected).
However, I kept your version, as it's more elegant.
Also, I checked that utf8 does not need double quotes, the file created without the quotes is still utf8.
Thanks!
However, I kept your version, as it's more elegant.
Also, I checked that utf8 does not need double quotes, the file created without the quotes is still utf8.
Thanks!
Re: Emulate SendTo folder as a user button
Well you just taught me something, that XY automatically enables dropping on buttons without having to include that functionality in the script, and about the utf8 quotes, they are a requirement AFAIK but XY is pretty tolerant about them being missing and handles it well, but in some situations it could cause problems if they are missing.