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?
Save up to 50% on our desktop apps during our Year End Sale!Save up to 50% on our desktop apps during our Year End Sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save up to 50% on our desktop apps during our Year End Sale!

Paste Newest History Item and Remove

Description
This script will paste the latest history item and then remove it from the history list.
Language
C#.net
Minimum Version
Created By
Goran Genter
Contributors
-
Date Created
Oct 13, 2020
Date Last Modified
Oct 13, 2020

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 newest entry
			text = BFS.ClipboardFusion.GetHistoryText(0);
			BFS.Clipboard.PasteText(text);
		
			//--now clear history
			BFS.ClipboardFusion.ClearHistory();
			
			//--then rebuild from temporary array
			for(int i = count - 1; i > 0; i--)
			{
				BFS.ClipboardFusion.AddHistoryText(history[i]);
			}
		}

		return null;
	}
}