using System;
using System.Collections.Generic;
// 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)
{
//File Explorer Command Line Parameters can be found here:
// https://support.microsoft.com/en-us/help/152457/windows-explorer-command-line-options
//find the first instance of a file list in the clipboard history
int index = -1;
for(int i = 0; i < BFS.ClipboardFusion.GetHistoryItemCount(); i++)
{
if(!BFS.ClipboardFusion.GetHistoryIndexContainsFileList(i))
continue;
index = i;
break;
}
//if we couldn't find a file, show a message and exit the macro
if(index == -1)
{
BFS.Dialog.ShowMessageError("There are no files on the Clipboard Manager");
return null;
}
//open File Explorer with selected file highlighted
BFS.Application.Start("C:\\Windows\\explorer.exe", string.Format("/select,\"{0}\"", BFS.ClipboardFusion.GetHistoryFileList(index)[0]));
//let clipboardfusion know that we dont need the clipboard changed
return null;
}
}