Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Paste Oldest History Item and Remove

Description
This Macro will paste the oldest History item and remove it from the history when done.
Language
C#.net
Minimum Version
Created By
David43873
Contributors
-
Date Created
Sep 27, 2017
Date Last Modified
Sep 27, 2017

Macro Code

using System;

public static class ClipboardFusionHelper
{
	public static string ProcessText(string text)
	{
		int count = BFS.ClipboardFusion.GetHistoryItemCount();
		
        //--pull entire history into temporary array	
		string[] history = BFS.ClipboardFusion.GetAllHistoryText();
				
		//--if any history
		if(count > 0)
		{
			//--paste the oldest entry
			text = BFS.ClipboardFusion.GetHistoryText(count - 1);
			BFS.Clipboard.PasteText(text);
		
			//--now clear history
			BFS.ClipboardFusion.ClearHistory();
			
			//--then rebuild from temporary array
			for(int i = count - 2; i >= 0; i--)
			{
				BFS.ClipboardFusion.AddHistoryText(history[i]);
			}
		}

		return null;
	}
}