Automatic Capture

The Windows clipboard can only hold one piece of information, which is often insufficient. AceText’s ClipHistory, however, can hold as many clips as you want. Whenever you copy some text to the Windows clipboard, AceText grabs it and adds it to the ClipHistory. That way, you can easily work with many bits of text.

Whenever AceText automatically captures a clip into the ClipHistory it flashes the icon of the New Clip command in the notification area on the Windows taskbar next to the system clock. If you don’t see the icon, click the < button in the notification area and drag AceText’s icon from the popout onto the taskbar. This way you can confirm with a glance whether AceText did capture the text you just copied. If it flashes the Lock Collection icon that means AceText couldn’t capture the text you just copied because the ClipHistory is locked. You’ll need to unlock it first. If the icon doesn’t flash at all that means AceText ignored the clip for one of the reasons explained in the following paragraphs.

You can use the Automatic Capture button on the ClipHistory toolbar or the Automatic Capture item in the Operation menu to temporarily stop AceText from automatically capturing any text you copy. This can be useful if you’ll be copying and pasting some sensitive data that you don’t want AceText to make copies of.

In the Operation Preferences you can configure the maximum size and maximum number of clips that AceText should capture and how to deal with duplicate clips.

If you never want AceText to automatically capture text copies by certain applications or windows then you can configure those in the Applications Preferences and the Windows Preferences. There you can permanently disable automatic capture for specific applications and windows.

An application can signal AceText and some other clipboard managers not to automatically capture text it copies by placing the ExcludeClipboardContentFromMonitorProcessing format onto the clipboard in addition to the actual text. AceText never automatically captures text that is copied with this flag, regardless of any settings. The clipboard history that is built into Windows 10 and 11 also respects this flag.

This method allows the application that copies the text to control whether clipboard managers (that support this flag) should capture the text. It could even do so selectively, by adding the flag only when copying certain text. AceText itself places this flag on the clipboard every time it copies something to the clipboard. This way, if you are using multiple clipboard managers (that support this flag), your clips don’t get needlessly duplicated in the other clipboard managers.

If you would like an application to support this flag, you can ask the developers of that application to implement the following. The application should declare a 32-bit unsigned integer variable that we’ll call CF_ExcludeClipboardContentFromMonitorProcessing. Before the application copies any text to the clipboard, it should perform this assignment once:

CF_ExcludeClipboardContentFromMonitorProcessing :=
  RegisterClipboardFormat('ExcludeClipboardContentFromMonitorProcessing');

Then it can copy text to the clipboard and tell AceText and other compatible clipboard managers not to capture it like this:

if OpenClipboard(hwnd) then begin
  EmptyClipboard();
  SetClipboardData(CF_ExcludeClipboardContentFromMonitorProcessing,
    GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE or GMEM_ZEROINIT, 8));
  // Call SetClipboardData again to add the actual text or other data
  CloseClipboard();
end;

When putting multiple formats on the clipboard, it is very important that all calls to SetClipboardData() happen between a single pair of calls to OpenClipboard() and CloseClipboard(). This ensures that AceText and other clipboard managers only see a single clipboard change event. Then the order in which you add the different formats doesn’t matter.

The actual data the application places on the clipboard for the CF_ExcludeClipboardContentFromMonitorProcessing format doesn’t matter. AceText only checks whether the clipboard format is available. It doesn’t look at the data. SetClipboardData(CF_ExcludeClipboardContentFromMonitorProcessing, 0) would also work. But then the format would be removed from the clipboard when your application terminates. Allocating a dummy buffer of 8 bytes ensures the clipboard retains the CF_ExcludeClipboardContentFromMonitorProcessing flag when the application terminates. The clipboard itself will deallocate the buffer when it is no longer needed.

AceText also recognizes the “Clipboard Viewer Ignore” flag that was invented by Chris Thornton, developer of ClipMate, a decade or two before Microsoft came up with the ExcludeClipboardContentFromMonitorProcessing flag. It works in exactly the same way. You just use a different string to register the clipboard format:

CF_CLIPBOARD_VIEWER_IGNORE :=
  RegisterClipboardFormat('Clipboard Viewer Ignore');

When AceText uses the clipboard to transfer text to another application it adds both the ExcludeClipboardContentFromMonitorProcessing and “Clipboard Viewer Ignore” formats to the clipboard to signal both modern and legacy clipboard managers to ignore the operation.