Processing Ajax...

Close Dialog


Close Dialog

Close Dialog

Get Filenames from Clipboard

If you have file objects on the clipboard (i.e. copied from File Explorer), this macro will get their filenames and put them on the clipboard as a text list.
Minimum Version
Created By
Thomas Malloch (BFS)
mavaddat, UWK-87
Date Created
Oct 16, 2017
Date Last Modified
Nov 21, 2017

Macro Code

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;

// The 'text' parameter will contain the text from the:
//   - Current Clipboard when run by HotKey
//   - History Item when run from the History Menu
// The returned string will be:
//   - Placed directly on the Clipboard
//   - Ignored by ClipboardFusion if it is 'null'
public static class ClipboardFusionHelper
	public static string ProcessText(string text)
        //copy the select item
        //if the clipboard contains a file, return its filename
        if((Clipboard.ContainsFileDropList()) && (Clipboard.GetFileDropList().Count > 0))        
            //Check if multiple files are selected i.e. more than one)
			if(Clipboard.GetFileDropList().Count > 1)
                string FileNames = null;
                //Copy all the file names in the selection to FileNames
				for(int fileCount = 0; fileCount < Clipboard.GetFileDropList().Count; fileCount++)
                    FileNames += Path.GetFileName(Clipboard.GetFileDropList()[fileCount]) + Environment.NewLine ;
				return FileNames;
            return Path.GetFileName(Clipboard.GetFileDropList()[0]);
 		return text;