1 Attachment(s)
Registry: "Copies the current selection onto the clipboard" syntax.
Is there a way to copy all the user highlighted items in the file manager
(explorer) to the clipboard first before starting my little program?
Will "daisy-chaining" the commands work?
What is the syntax that will copy the highlighted files to the clipboard?
HKCR\...\shell\My Program\command = "?%CopyToClipboard%?" "path\to\myprogram.exe"
Attachment 99153
scot-65
Re: Registry: "Copies the current selection onto the clipboard" syntax.
If you want to copy files in the explorer, highlight them and press control-c.
Insofar as using the registry to copy things NO!. The registry is nothing but a huge repository of information used by the os. The first thing you should do is close the registry and never open it again until you know for sure what it is. You can give your self (or your admin) one heck of a headache by messing in the registry without knowing what you are doing.
Re: Registry: "Copies the current selection onto the clipboard" syntax.
If you issue a command to copy a file from Explorer to the clipboard, that's exactly what it does ... copies the file. You don't want to copy the file, you want to copy the filepaths and Windows doesn't have a built-in way of doing that. Or at least I think that's what you want. If you do actually want to move/copy files to a subfolder then Explorer already has a bunch of functions built in for that purpose so I'm not really sure why you wouldn't just use them.
2 Attachment(s)
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
kebo
If you want to copy files in the explorer, highlight them and press control-c.
Insofar as using the registry to copy things NO!. The registry is nothing but a huge repository of information used by the os. The first thing you should do is close the registry and never open it again until you know for sure what it is. You can give your self (or your admin) one heck of a headache by messing in the registry without knowing what you are doing.
What I am looking for is the proper syntax that is represented by the following action in the file manager:
Attachment 99191
or
Attachment 99193
I hope this is clear enough.
Re: Registry: "Copies the current selection onto the clipboard" syntax.
look in the IO namescape....
IO.File.Copy(souce, destination)
IO.File.Move(sourceFileName,destination)
IO.Directory.Move(sourceDirName,destination)
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Using kebo's suggestion above you could store that information in a temp string or in a hidden text doc and run it later.
Re: Registry: "Copies the current selection onto the clipboard" syntax.
...and the documentation! :D
System.IO.File.Copy
System.IO.File.Move
System.IO.Directory.Move
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
dunfiddlin
If you issue a command to copy a file from Explorer to the clipboard, that's exactly what it does ... copies the file. You don't want to copy the file, you want to copy the filepaths and Windows doesn't have a built-in way of doing that. Or at least I think that's what you want. If you do actually want to move/copy files to a subfolder then Explorer already has a bunch of functions built in for that purpose so I'm not really sure why you wouldn't just use them.
I am investigating the clipboard.idataobject.getdata(dataformats.filedrop) method {syntax error, quick reply here}.
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
mholmes_3038
Using kebo's suggestion above you could store that information in a temp string or in a hidden text doc and run it later.
I wish to gather this information before the file manager (explorer) looses focus.
Any ideas as to how to proceed?
So by declaring HKCR\...\command = "System.IO.File.Copy" "path\to\myprogram.exe", this should work?
Not giving up.
Re: Registry: "Copies the current selection onto the clipboard" syntax.
I repeat, stay out of the registry... proceed at your own risk...
I'm a bit confused about what you are trying to do, but to get the contents of a file explorer copy from your app you can use the following...
Code:
Public Function GetClipboardText() As String()
Dim objClipboard As IDataObject = Clipboard.GetDataObject()
If objClipboard.GetDataPresent(DataFormats.FileDrop) Then Return objClipboard.GetData(DataFormats.FileDrop)
End Function
that code will give you the file name/path of everything you copied from the file explorer
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
kebo
I'm a bit confused about what you are trying to do
I have created a entry in the registry:
HKCR\*\shell\move to subfolder\command = "path\to\myprogram.exe" "%1"
However the %1 only passes the (highlighted) file that was targeted when I did the right-click.
I want ALL files that are highlighted to be passed when I right-click and select the "move to subfolder" line.
I do NOT want to right-click and "Copy", then right-click again to start my program.
I DO want to combine the copy and starting of my program as one command.
Still confused?
As one command:
HKCR\*\shell\move to subfolder\command = "[Ctrl]+C" "path\to\myprogram.exe" "%1"
My original question:
How to represent "[Ctrl]+C" in the above line?
Re: Registry: "Copies the current selection onto the clipboard" syntax.
I have looked at this a bit more and you are dealing with limitation of the explorer rather than a .net programming issue. In this link surfasb mentions using the Send To context menu instead. It may be a better option for you.
GL
kevin
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
kebo
I have looked at this a bit more and you are dealing with limitation of the explorer rather than a .net programming issue.
In this link surfasb mentions using the Send To context menu instead. It may be a better option for you.
GL
kevin
Thank you for taking the time to research my inquiry.
My VB skills are not enough to create a CLSID/dll's for a top level context-menu item at this time.
Thanks again.
scot-65
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
HKCR\*\shell\move to subfolder\command = "path\to\myprogram.exe" "%1"
I dealt with this question in another thread recently. %1 gives you a single file option. %L will accept multiple files but it will open a separate instance of your program for each one. It does seem increasingly to me that you're reinventing the wheel here for no obvious gain over the Windows options. I do notice that you don't appear to have theCopy To Folder and Move To Folder options on your context menu which I would certainly recommend activating (most Windows 'tweakers' will see to that for you).
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Quote:
Originally Posted by
dunfiddlin
I dealt with this question in another thread recently. %1 gives you a single file option. %L will accept multiple files but it will open a separate instance of your program for each one. It does seem increasingly to me that you're reinventing the wheel here for no obvious gain over the Windows options. I do notice that you don't appear to have theCopy To Folder and Move To Folder options on your context menu which I would certainly recommend activating (most Windows 'tweakers' will see to that for you).
Yes sir, I am inventing a better mouse trap. Also learning how to program in VB. Explorer is fine.
Suppose a folder contains 1000+ files. Imagine unloading a digital camera with large capacity.
Mixed inside the numerous pictures are a few pictures of my wife's cooking - scattered everywhere.
I wish to filter out these pictures of my wife's dishes from the large list of pictures in the folder.
How many mouse clicks/keyboard actions will it take to move a group of these pictures to a subfolder?
1) Now imagine highlighting the desired files.
2) Right-click and select Move to Subfolder. A small App opens and the Textbox displays last folder entered.
3) Either accept [Enter] the folder name or type a new/existing folder name and [Enter].
Program processes, Textbox value is saved, dialog closes, focus goes back to explorer, and last known
position in explorer is not lost.
If the left pane of explorer is in tree view, and one tries to drag and drop, the list pane does sometimes
jump, and last known position can be lost. If the subfolder count is rather long in the tree view, there is
a chance the files may drop into an undesirable folder. Been there, done that, let's find a better way.
:)
Re: Registry: "Copies the current selection onto the clipboard" syntax.
Again .... Copy To Folder and Move To Folder ... are available already.