Purpose
Copy files to the clipboard

With GuiXT CopyText ... -toClipboard you can copy text to the clipboard, but not files

Solution
Use a JavaScript or VB call which invokes the "Shell.Application" object.

Example
The following JavaScript function copies a given file to the clipboard. It can also be used to copy a whole subfolder.

function to_clipboard(foldername, itemname) {
   
var shell = guixt.CreateObject("Shell.Application");
    var folder = shell.NameSpace(foldername);
    var item = folder.ParseName(itemname);
    item.InvokeVerb('copy');
}

 

GuiXT script:

CallJS
to_clipboard "C:\temp"  "abc.txt"   


GuiXT script to copy a subfolder "images":

CallJS
to_clipboard "C:\temp"  "images"   

 

Remark
If you prefer to copy all files of a given subfolder, e.g. "images" in the example, use the following function:

function files_to_clipboard(foldername, subfoldername) {
   
var shell = guixt.CreateObject("Shell.Application");
   
var folder = shell.NameSpace(foldername);
   
var subfolder = folder.ParseName(subfoldername).GetFolder;
    var items = subfolder.Items();
    items.InvokeVerbEx('copy');
}



GuiXT script to copy all files of subfolder "images":

CallJS
files_to_clipboard "C:\temp"  "images"   

 

Components
InputAssistant + Controls