Command: ClipboardEx (clipboard related functions)

Introduction:
ClipboardEx Script command which provides additional clipboard related functionality.

This command adds new features and extends functionality of these existing script addins:
ClipAtt - Thanks Leo, took your code o):

PasteToFolders (obsolete):

.

Main command line switches:

  • COPYTIMESTAMPS
    Copy timestamps of selected items to (DO internal) clipboard.

     Options:
         <all>    = default, copy all timestamps
         created  = copy only creation timestamp
         modified = copy only modified timestamp
    
     Example:
         ClipboardEX COPYTIMESTAMPS FROM=C:\File01.txt
         ClipboardEX PASTETIMESTAMPS TO=C:\File02.txt
    
         Or in one single step:
         ClipboardEX COPYTIMESTAMPS FROM=C:\File01.txt TO=C:\File02.txt
    
  • PASTETIMESTAMPS
    Paste timestamps to selected items from (DO internal) clipboard.
    Timestamps will cycle if there are more items than timestamps in the internal clipboard.

     Options:
         <all>    = default, copy all timestamps
         created  = copy only creation timestamp
         modified = copy only modified timestamp
    
     Example:
         ClipboardEX PASTETIMESTAMPS
         ClipboardEX PASTETIMESTAMPS=created
         ClipboardEX PASTETIMESTAMPS TO=C:\File02.txt
    
  • FROM
    Specifiy items to copy from (separate full item-paths by ";")
    Meant to be used with COPYTIMESTAMPS (optional in this case, since current selection will be used).

  • TO
    Specifiy items to copy timestamps to (separate full item-paths by ";")
    Meant to be used with COPYTIMESTAMPS, PASTETIMESTAMPS (optional in this case, since current selection will be used).

  • COPYNAMES/K Copy paths and filenames of selected items to clipboard.

      Options:
      allunc    = Contrary to the internal "Clipboard COPYNAMES=unc" command, this one does convert
                  file-paths to UNC format *even for local drives* by autodetecting the local ip-address.
                  Local drive letters will be converted to admin-shares (C: -> \\localhost\C$).
                  For pasting, please watch the PASTEFROMCLIP switch.
      
      The default Clipboard COPYNAMES command will be used if no option is given.
    
  • PASTEFROMCLIP/S
    Paste clipboard items. Contrary to the internal "Clipboard PASTE" command, this ne also supports filesystem items from a textual list in the clipboard. This is handy if you stored paths to files and folders in text form (in an email e.g.) and want to create real copies of these items.

  • PASTETOFOLDERS/S
    Paste text or regular items from the clipboard to all selected folders. The dedicated script command "PasteToFolders" is obsolete with this, will not be updated anymore and does not support textual clipboard content.

      FOLDERS/O
          Since v.0.3.7 you can also specifiy the target folders by providing a single path or
          multiple paths to the FOLDERS option (separate paths by ";").
                                                 -
    
  • PASTETOCONTAINERS/S
    Paste text or regular items from the clipboard to the containing folder of selected items. This is handy for moving items around in "flatview no folders" mode. You can move and copy items by pasting items directly over others, which already reside in the desired target. The location column is a good place to see where your items go.

  • MOVE/S
    Move items instead of copying them.
    Meant to be used with PASTEFROMCLIP, PASTETOFOLDERS and PASTETOCONTAINERS.

  • PASTEEMPTY/S
    Create empty files or folders from text, paths or filenames in clipboard. Very handy for quickly creating a bunch of empty files to test commands or scripts on. Empty folders need a trailing "\" to be identified as folders if you use text clipboard data. Location information (drive or UNC hostname) will always be ignored when creating the empty files and folders. Just the plain path information will be rebuilt. To create empty files without path/folder information, use "Copy File Names" function from the Edit menu (Clipboard COPYNAMES=nopaths) before or just don't provide path information in the text clipboard.

  • TRIM/O
    Trim clipboard content. Trimming left and right is default handling.
    You can trim left by using TRIM=left or trim only on the right hand side with TRIM=right.

  • TRIMCHARS/O
    The characters to trim. Default is " " (blanks).

  • CLEAR/S
    Clear clipboard content.

  • PT/R
    Pass through any option or switch to internally used DO commands.
    Example:

Global switches:

  • XLOG/O
    Level of output, defaults to normal, which means important information only.
    Options: off,xit,err,inf,warn,< normal >,trace,dump,all

.

Installation:
To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that the command shall be ready to use in buttons, scripts and externally from dopusrt.exe of course.

cya,
tbone
.

Download:
Latest:

3 Likes

The PASTETOFOLDERS is very useful for me, thanks tbone.

Thanks a lot tbone! Indeed the PASTETOFOLDERS is very handy!

Updated to v0.2:

Nice, Thanks :slight_smile:
I would like to change the default paste behaviour to include PASTETOFOLDERS, instead of having a separate button for it. Is it possible? Currently, the Ctrl+V key is assigned

Clipboard PASTE USESELHow should it be changed?

Try this.. It uses "ClipboardEx PASTETOFOLDERS" whenever there are multiple folders selected.
The regular paste will be used for all other cases. Don't forget to change button-type to "Script Function" and set the script type to "JScript"

function OnClick (data) {
	var f = data.func, cmd = f.command, tab = f.sourcetab;
	if (tab.selected_dirs.count>1)
		cmd.RunCommand('ClipboardEx PASTETOFOLDERS');
	else
		cmd.RunCommand('Clipboard PASTE USESEL');
}

Great, it works! Thanks!!!
Just observed.. when a file is CUT and paste with multiple folders selected, it gets copied to all those folders, but the original file is left undeleted. Not a big deal, but just wanted to bring to your notice :slight_smile:

Good find, unfortunately there's nothing I can do about that. o) The script cannot determine wether the clipboard content has been "cut" or "copied". The DO devs would need to add some kind of operation-indicator to the scripting API. I ran into the same, so maybe it's time to ask them? Leo, Jon - what do you think? o)

I love you for PASTETOFOLDERS. \o/

Updated to v0.3:

  • new feature "TRIM" to trim clipboard content (supports left and/or right trimming and user defined characters to cut away)
  • internal enhancements

Updated to v0.3.1:

  • more efficient and robust TRIM
  • new CLEAR argument to clear the clipboard

Updated to v0.3.5:

  • new feature "PASTETOCONTAINERS" to copy/move clipboard items to the parent folder of items.
    This is handy for moving items around in "flatview no folders" mode by "pasting" onto items,
    which already reside in the desired target (as shown in location column e.g.).
  • new switch "MOVE" to move items instead of coping for PASTEFROMCLIP, PASTETOFOLDERS and PASTETOCONTAINERS

Hi tbone, PASTETOCONTAINERS is a must have to me, thank you very much for that !
The must would to be able to use the soft links or junctions of folders with ClipboardEx (for example with the copy to multifolder option).

Updated to v0.3.7:

  • new "FOLDERS" option to be used with "PASTETOFOLDERS" (so you can hard-wire several target folders e.g., no selected folders required with this)

@mykael
Unfortunately I did not understand your sentence regarding the soft links and junctions, maybe try again! o)
Maybe the new option already works the way you need it, probably worth a try. o)

You don't like my frenglish ?? lol
ok give me an extra ball and let me shoot again :
I would like ClipboardEx to be able to copy/move to directories, pointed with soft links, hard links and junctions.
please, have a look to gpsoft.com.au/help/opus12/D ... ctions.htm
The english in the manual is much better lol

Ok, well I expect it to work with links and junctions, please try. o)

@tbone I tried with soft links.. And it worked with the PASTETOFOLDERS switch.
(I used PASTETOCONTAINERS before and it didn't work but it was stupid :slight_smile: ).
Thank you very much for everything...

When I use PASTETOFOLDERS, I have some duplicate files, I want to automatically ignore these duplicate files, can add a ignore duplicate file Button? Thanks!

Please give a a more detailed explanation of what you are trying/seeing. Thx!

When I use PASTETOFOLDERS, I have some duplicate files to paste, I want to automatically ignore these duplicate files. This plugin may be able to add a button options.In the jpg under the two buttons , add a options"automatically remove duplicate files", rather than each time click skip this file.