using System; using System.Collections.Generic; public static class ClipboardFusionHelper { public static string ProcessText(string text) { BFS.Clipboard.CopyText(); BFS.Application.Start("notepad.exe"); IntPtr mainWindow = BFS.Application.GetAppIDByWindow("Untitled - Notepad"); BFS.Window.Focus(mainWindow); //BFS.General.ThreadWait(500); BFS.Clipboard.Paste(); return text; } }
using System; using System.Collections.Generic; public static class ClipboardFusionHelper { public static string ProcessText(string text) { // Copy the selected text BFS.Clipboard.CopyText(); // Launch Notepad uint appID = BFS.Application.Start("notepad.exe"); // Wait up to 10 seconds for it to open and receive focus for (int i = 0; i < 10; i++) { // If the newly launched Notepad window has focus, paste the text and break out of the loop if (BFS.Window.GetFocusedWindow() == BFS.Application.GetMainWindowByAppID(appID)) { BFS.Clipboard.Paste(); break; } // If we got here, the Notepad window doesn't yet have focus, wait 1 second before restarting the loop BFS.General.ThreadWait(1000); } return text; } }
using System; using System.Collections.Generic; using System.Windows.Forms; using System.IO; public static class ClipboardFusionHelper { public static string ProcessText(string text) { // Copy the selected text text = BFS.Clipboard.CopyText(); // If the copied selection is a file list from Explorer, run the "Get Filenames from Clipboard" macro if (Clipboard.ContainsFileDropList()) { BFS.ClipboardFusion.RunMacro("Get Filenames from Clipboard", text, out text); BFS.Clipboard.SetText(text); } // Launch Notepad uint appID = BFS.Application.Start("notepad.exe"); // Wait up to 10 seconds for it to open and receive focus for (int i = 0; i < 10; i++) { // If the newly launched Notepad window has focus, paste the text and break out of the loop if (BFS.Window.GetFocusedWindow() == BFS.Application.GetMainWindowByAppID(appID)) { BFS.Clipboard.Paste(); break; } // If we got here, the Notepad window doesn't yet have focus, wait 1 second before restarting the loop BFS.General.ThreadWait(1000); } return text; } }