Title

Message

Confirm

Open Files/Folders in Explorer

< Return to ClipboardFusion Macros

Open Files/Folders in Explorer

Description
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;
}
}
Language
C#
Minimum Version 4.2+
Created By Thomas Malloch (BFS)
Contributors -
Date Created
Jul 19, 2017
Date Last Modified
Jul 19, 2017

Macro Code

Macro Help

Macro Help

Want to create your own Macro or modify an existing one?
Visit our Macro Help page for more information on the available functions.