Skip to content

hi5/CL3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

64 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CL3 v1.110 - Clipboard caching utility

CL3 started as a lightweight clone of the CLCL clipboard caching utility which can be found at http://www.nakka.com/soft/clcl/index_eng.html. But some unique features have been added making it more versatile "text only" Clipboard manager.

Intended for AutoHotkey Unicode (64-bit version of AutoHotkey is automatically Unicode).

πŸ’‘ Relies standard copy/paste shortcuts for the applications you are using, so Ctrl+c and Ctrl+v, and right click "copy" via mouse actions. Programs that rely on other shortcuts to store/restore clipboard contents may not work (e.g. vim).

πŸ’¬ Forum thread https://autohotkey.com/boards/viewtopic.php?f=6&t=814

πŸ’‘ The changelog.md contains some additional information about certain features.

Shortcuts

Key1 Action
Ctrl+Alt+v Open the Clipboard history menu.
Ctrl+Shift+v Paste the current clipboard content as plain text.2
Undefined Paste most recent item added to the clipboard unmodified.3
Ctrl+Win+h Open the Search GUI and search the clipboard history. (Also delete and edit entries)
Ctrl+Win+F12 Open the Slots GUI and define your 10 texts for quick pasting. Quick pasting via RCtrl+1, RCtrl+2 to RCtrl+0.
Ctrl+Win+F11 Open/close the ClipChain GUI - cycle through a predefined clipboard history - see Wiki
Ctrl+Win+F10 Start FIFO (Reverse paste) plugin - Ctrl+Shift+Win+F10 stops FIFO.
LWin+v, hold LWin Repeatedly tap v to cycle through the clipboard history. Release LWin to paste.
LWin+c, hold LWin To cycle forward, repeatedly tap c. Release LWin to paste.
LWin+f, hold LWin To cycle through plugins repeatedly tap f. Release LWin to paste. You can use this in combination with #+v and #+c
LWin+x Cancel "cycle" pasting. (also for plugins #+f)

Note 1: as of v1.93 you can define these Shortcuts via Settings.ini or use the Tray menu, Settings option.

Note 2: Ctrl+Shift+v pastes the current clipboard item as plain (unformatted) text - this can be useful if you have selected rich / formatted text but don't want to paste that in your current application.

Note 3: As CL3 might modify the clipboard content when using AutoReplace, the most recently copied item to the clipboard (after Ctrl+c) is also stored unmodified thus preserving the original format (layout, images, etc) - Define a hotkey in the Settings to paste this unmodified Clipboard.
Suggestion: Ctrl+Shift+Capslock, define as: ^+CAPSLOCK
This may be useful in Word processing or other specific formats if you notice formatting is lost or changed upon a regular paste (Ctrl+v).

About CL3

It is not meant to compete with the many clipboard caching utilities that are (freely) available, but merely as minimal program focusing on text only.

You can call the clipboard history menu by its default hotkey Ctrl+Alt+v If you prefer another hotkey you can change this and the other hotkeys via the Settings menu. Use the AutoHotkey syntax - more info about they syntax here https://autohotkey.com/docs/Hotkeys.htm#Symbols

CL3 gets its name from CLCL CLone = CL3

Features

  • Captures text only
  • Limited history (18 items+26 items in secondary menu, does remember more entries in XML history file)
  • Search history (v1.2+)
  • 10 Slots with options to save/load several sets (v1.2+)
  • Cycle through clipboard - forwards and backwards - with tooltip preview (v1.3+). Cycle through plugins (v1.8+)
  • ClipChain with preview GUI, paste items in predefined order, save/load several sets (v1.5+) Wiki
  • Supports FIFO (first in first out) pasting (v1.7) #3
  • Remove (yank) entries from history
  • No duplicate entries in clipboard (automatically removed)
  • Templates: simply text files which are read at start up
  • Plugins: AutoHotkey functions (scripts) defined in separate files

Templates

Any text file placed in the templates\ directory will be read at start up and added to the Templates sub-menu - press t to quickly access them while the menu is active.

File names act as name of the menu entry and are sorted alphabetically before being added to the menu. You can influence the order of the menu entries by naming your files in the order you wish them to appear.

As of v1.9+ Templates now support sub-folders. A Sub-folder will be added as a sub-menu entry and its text files processed as described above. If a "favicon.ico" is present in a sub-folder it will be used in the Templates Menu, otherwise it will use the default Template icon (res\icon-t.ico)
As of v1.100+: Add settings.ini to (each) sub-folder with a shortcut key (AutoHotkey syntax) to be able to display the templates in the sub-folder directly to avoid the need to bring up the main menu (allowing for faster access)

[settings]
shortcut=#Numpad8

Note: there is one default entry in the Templates menu: "0. Open templates folder" which will open the templates folder in Total Commander - if it is running - or the standard file explorer (see the TemplateMenuHandler label)

Example

File name: "templates\01_Boiler plate 1.txt" will be a "menu entry:" as "&a. Boiler plate 1"

If you add new text files to the templates directory you need to reload the script in order for them to appear in the templates sub-menu.

Plugins

Plugins are AutoHotkey functions you will need to #include in the script in order for them to work. A plugin acts on the current clipboard content and changes it before it is being pasted.

Adding plugins

As of v1.6 a new method of adding plugins is recommended, see comments in plugins.ahk for instructions

Default plugins included with CL3 ([v1.0]):

  1. Lower Replace Space (convert to lower case, replace any spaces with an underscore)
  2. Lower (convert to lower case)
  3. Upper (convert to upper case)
  4. Title (convert to title case, basic)
  5. see other updates for more

Search plugin [v1.2+]

As of v1.2 you can now search the CL3 history, hotkey Ctrl+Win+h simply start typing, press enter will paste the first result or you can use the UP & DOWN keys to navigate the result list. See screenshot.

As of [v1.6] you delete entries directly via the history search Gui, just press Ctrl+Del on the highlighted entry in the list.

As of [v1.8] you edit entries directly via the history search Gui, just press F4 on the highlighted entry in the list to edit. After editing the entry should stay highlighted so you could paste it directly by pressing enter or the OK button.

Slots plugin [v1.2+]

Press Ctrl+Win+F12 to open the Slots GUI and define your 10 texts for quick pasting. See screenshot.

To facilitate quick pasting of predefined texts you can use the RCtrl+1 .. RCtrl+0 hotkeys. By default the 10 predefined texts are stored in slots.xml but you can save and load as many slot-files as you like via the buttons available when the Slots gui is open. The last set used is always stored in slots.xml

SlotsMenu [v1.101+]

To display the Slots as a menu, define a Hotkey in the Settings, this will also include any Named Slots you defined via ccmdr (see docs\ccmdr.md)

Dump History plugin [v1.32+]

You can export the current clipboard history to a plain text file via the Special, Dump History menu option.
The text file will be placed in the CL3 script folder.

AutoReplace [v1.4+]

You can use the AutoReplace plugin to modify the text in the clipboard using a find/replace rule before adding it to the history. You can use StringReplace or a Regular Expression. Settings are stored in AutoReplace.xml Note: very experimental plugin. The plugin interface (GUI) needs to refined, entire process should be improved. A Listview would be more logical and flexible. But for now it does the job, albeit crudely.

Feedback available via "Tray Tip" - see settings.

ClipChain [v1.5+]

The CL3 ClipChain plugin allows you to cycle through a predefined clipboard history.
With each paste it advances to the next item in the chain. The item to be pasted next is indicated in the listview with a >>.
When the last item is reached it moves back to the start. See Wiki
The most recently used chain is stored in clipchain.xml.

ClipChain Hotkey

By default Ctrl+v will paste and proceed to the next item in the chain. You can define another hotkey in the Settings menu. This will allow you to keep Ctrl+v for normal copy/paste functionality.

Compact [v1.6+]

If you have a lot of entries in the history or one or more very large (kb) entries. CL3 can become a bit sluggish. You can use the Compact plugin to:

  • remove entries over certain size (user specified)
  • keep only the most recent specified number of entries (e.g. 100 -> keep 1..100 most recent, remove all older from history)

FIFO [v1.7+]

FIFO (first in first out) will allow you to paste entries back in the order in which the entries were added to the clipboard history.

Press Ctrl+Win+F10 to bring up the clipboard history menu (sans plugins and templates) and select the entry you want FIFO to start with, nothing is pasted yet.
You can stop FIFO by:

  • Bringing up the regular Clipboard history Ctrl+Shift+v
  • Press Ctrl+Shift+Win+F10 (special FIFO shortcut)
  • Press Ctrl+Win+F10 and choose "Exit (close menu)" (or press ESC)

You add 1, 2, 3, 4 to the clipboard history. The history menu would look like this:

a. 4
b. 3
c. 2
d. 1

If you start FIFO at 'D' pressing Ctrl+v four times will paste 1, 2, 3, 4.
After pasting the last (here fourth) item, FIFO stops.
TrayTips will appear at the start and stop of a FIFO cycle.

Sort [v1.94+]

Sort via a number of predefined settings or set specific options via small Gui (see "Set Delimiter and other options" in Sort menu).
See Sort documentation for explanation.

Yank (delete) entry

If you select the yank option in the menu you will be presented with a simple a to r menu to indicate which of the most recent items you wish to delete.

Cycle through clipboard history [v1.3+]

If you press LWin+v, hold LWin and repeatedly tap v you can cycle through backwards through the clipboard history - a tooltip with the text to paste will be shown, if you release LWin the text will be pasted.

To cycle forwards press LWin+c.
Caveat: if you press LWin+c before LWin+v nothing will be pasted upon release of the LWin key.

To cancel pasting press LWin+x.

After reaching "Max History" it will cycle back to the first entry in the history (for a Max History of three: a->b->c->a).

To apply a plugin (see below), hold LWin and press f repeatedly to select a plugin.

See Wiki

Cycle through plugins [v1.8+]

Press LWin+f to cycle through pre-defined plugins, it shows a preview in the tooltip. You can combine this with LWin+v and LWin+c. To cancel pasting press LWin+x.

In settings.ini you can define and set the order of the plugins you cycle through. The plugins have to be of a similar format to Lower and Upper for example (e.g. just calling a function to alter the current item).

See Wiki

Future plans

None really, but feel free to fork and extend the script and send a pull request.

Some ideas for further development you may wish to consider:

  • Allow the user to search the extensive history v1.2+
  • Exclude certain programs v1.99+
  • Extending the number of menu entries in the secondary menu ("more history") v1.100+
  • Include rich text formats
  • Include images - rough guide to add it (very alpha) here https://www.autohotkey.com/boards/viewtopic.php?p=314319#p314319
  • Introduce various paste methods, also for specific programs for example send each character individually
  • More (default) plugins:
    • Improved title case (various scripts are available which could replace the current basic one)
    • Strip HTML
    • Find, Replace in clipboard possible via editor
    • Reformat text, for example email reply format, wrap text etc
    • Plain text and/or Markdown to HTML conversion
    • ...

The WinClip class by Deo may be of interest to develop some of these ideas.

Screenshots

CL3 Menu

CL3 Slots

CL3 Search

CL3 ClipChain

Animations:

Credits

OCR-TIP

If you need to "grab" text from Images, Screens, Locked PDFs etc you can use one of these nifty AutoHotkey scripts:

  1. Vis2 by iseahound

I've added the following code to "plugins\myplugins.ahk" to start Vis2 when I need it:

#capslock:: ; winkey-capslock
Run %A_ScriptDir%\vis2\runocr.ahk ; path to vis2 code, see github link above
If !stats.visocr ; for statistics if you're interested in how many times you use it, you can omit this
	stats.visocr:=0
stats.visocr++
return
  1. Windows 10 OCR tool by malcev, teadrinker, and flyingDman

You can 'add' it to CL3 as shown above with the Vis2 example Run ...

Look for the line msgbox % text and change it to:

clipboard:=text
Sleep 100
ExitApp ; to close the script after OCR

After the OCR is complete it is added to the clipboard and thus the CL3 clipboard history.

General TIPs

As noted above, adding plugins via plugins\MyPlugins.ahk is the recommended method, see comments in plugins.ahk for instructions.

Apart from plugins, plugins\MyPlugins.ahk is also a useful method to add additional functions and/or hotkeys to CL3 without the risk of losing them when updating. (MyPlugins.ahk will never be part of the public CL3 repository)

  1. Copy or Cut and Append to clipboard

Some text editors already offer this functionality, but you make it available everywhere using CL3.
Add the following code for copy and/or cut to plugins\MyPlugins.ahk

; copy text and append to clipboard item so a, ab, abc, abcd etc
^+c::
OnClipboardChange("FuncOnClipboardChange", 0)
Send ^c
Sleep, 100
ClipText:=History[1].text . Clipboard ; if you want to use a separator insert it here e.g. "`n" or "|" 
StrReplace(ClipText, "`n", "`n", Count)
crc:=crc32(ClipText)
History[1,"text"]:=ClipText
History[1,"lines"]:=Count+1,
History[1,"crc"]:=crc
History[1,"time"]:=A_Now
Clipboard:=ClipText
Sleep, 100
ClipText:="",Count:="",crc:=""
OnClipboardChange("FuncOnClipboardChange", 1)
Return

; cut text and append to clipboard so a, ab, abc, abcd etc
^+x::
OnClipboardChange("FuncOnClipboardChange", 0)
Send ^x
Sleep, 100
ClipText:=History[1].text . Clipboard ; if you want to use a separator insert it here e.g. "`n" or "|" 
StrReplace(ClipText, "`n", "`n", Count)
crc:=crc32(ClipText)
History[1,"text"]:=ClipText
History[1,"lines"]:=Count+1,
History[1,"crc"]:=crc
History[1,"time"]:=A_Now
Clipboard:=ClipText
Sleep, 100
ClipText:="",Count:="",crc:=""
OnClipboardChange("FuncOnClipboardChange", 1)
Return
  1. Adding shortcuts for pasting clipboard entries directly
; forum post https://www.autohotkey.com/boards/viewtopic.php?f=76&t=90231&p=398527#p398527
^+1:: ; current clipboard
^+2:: ; second entry in clipboard history (b. in the menu)
^+3:: ; third entry in clipboard history (c. in the menu)
^+4::
^+5::
^+6::
^+7::
^+8::
^+9::
; add more if you wish, note that you need to modify the logic for "SubStr(A_ThisHotkey,0)" in that case
OnClipboardChange("FuncOnClipboardChange", 0)
Clipboard:=History[SubStr(A_ThisHotkey,0)].text
Sleep 200
PasteIt()
Sleep 200
Clipboard:=History[1].text
OnClipboardChange("FuncOnClipboardChange", 1)
Return

PastePrivateRules.ahk

Add an optional include file that "does something" before it actually pastes.
The file is not present in the repository and a new file has to be created in cl3\plugins\ with the name PastePrivateRules.ahk

Note: your PastePrivateRules.ahk will never be part of this GitHub repository so anything you add won't be overwritten if you update CL3 in the future.

Changelog

The changelog is available here: changelog.md