CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

Post your working scripts, libraries and tools for AHK v1.1 and older
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins...

19 Mar 2018, 13:57

I have considered making an API so you can (relatively) easily find + return items from the clipboard history from other scripts - using OnMessage or perhaps ObjRegisterActive (no idea what is "best" in that regard).
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins...

19 Mar 2018, 21:07

Oh cool!
I don’t know, I guess messages are simpler...
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins...

20 Mar 2018, 12:28

I'll experiment with it, created an Issue for it here https://github.com/hi5/CL3/issues/11 to keep track of progress/ideas.
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins...

05 Oct 2018, 14:36

v1.93
  • Hotkeys and some other basic settings via settings.ini, accessible via Tray menu Settings
  • Basic stats, accessible via Tray menu "Usage statistics"
  • Search Plugin: fix for first Down:: (see comment in code plugins\search.ahk)
  • Search Plugin: pressing hotkey again toggles Gui (e.g. hide, show like slots and clipchain already do)
  • Attempt to have more stable ToolTip (less/no flickering as it no longer continously updates the TT if nothing changes) - (Note: using ToolTipFont https://autohotkey.com/boards/viewtopic.php?f=6&t=4777 results in error for these cycle tooltips)
  • Updated from OnClipboardChange: to OnClipboardChange() - improved efficiency by turning it on/off at various "actions" and "plugins"
  • Improved MaxHistory, not just on OnExit but now continously keep it at set entries - should help with memory consumption and overall speed
  • Added some (generic) icons to tray menu
  • Fixed issue with Cycle paste not correctly updating History
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins...

27 Jan 2019, 08:47

v1.94
  • New: Sort plugin, also illustrating easy way to add submenu to a plugin - see plugins\sort.ahk
  • New: Option to show number of lines of an entry in CL3 Menu (see settings)
  • New: API see docs\cl3api.md
  • New: [Experimental] Notes plugin, append clipboard to (selectable via menu) note file(s) - see docs\notes.md
  • New: [Experimental] ccmdr plugin to allow batch operations and more on clipboard history, you need to activate this manually - see docs\ccmdr.md
  • Changelog.md split from readme.md
Edit: now v1.94.3 with various bug fixes of the new features - see changelog.md @ https://github.com/hi5/CL3
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

13 Feb 2019, 13:59

v1.94.4 various changes, recommended to update - https://github.com/hi5/CL3
  • Fix: DispToolTipText removed StringReplace ;
  • Change: Added Stringcasesense, On; also in Checkhistory as ==
  • Change: Cycle through plugins: Insert changed clip vs overwrite/replace
  • Change: (try) to keep original Icon of SOURCE of the clip vs where used LAST
  • ...
DRocks
Posts: 565
Joined: 08 May 2018, 10:20

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

14 Feb 2019, 00:03

Wow thank you.
I will try this out and might become dependant on this. I think its commun that ai need to have more than 1 clipboard but i currently have no tools to help me.

Thanks for your good work and sharing
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

14 Feb 2019, 12:23

Hope you like it, if you don't: there quite a few AutoHotkey clipboard scripts around on the forums or you can try one of the gazillion other clipboard managers out there (many of them freeware) :)

Windows 10 users can try a new feature built-in to Windows it seems (haven't tried it myself actually) https://www.howtogeek.com/351978/using-windows-10s-new-clipboard-history-and-cloud-sync/
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

19 May 2019, 03:23

v1.95 ClipChain setup hotkey*, AutoReplace default settings improvement @ https://github.com/hi5/CL3

* by default it is still ^v but you can change it something else so you can use ^c/^v as normal copy/paste and still keep the clipchain "active"
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

09 Jun 2019, 07:35

v1.95.2 Fix: Changed to #If for ClipChain paste hotkey (recommend to update) @ https://github.com/hi5/CL3/
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Jan 2020, 14:33

v1.96 @ https://github.com/hi5/CL3
  • API: added CL3Api_State to turn clipboard history on/off - incl. changing tray icon (same as tray menu option below)
  • Tray menu: Pause clipboard history - option to turn clipboard history on/off - incl. changing tray icon (same as api above)
  • Change: Slots - Restore current clipboard from History after pasting Slot entry
  • New option to paste unmodified clipboard entry, retains all formatting - see Note 3 in readme.md
  • Added WatchFolder() to automatically reload CL3 when a file in the Template folder is updated/added/removed
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

13 Feb 2020, 20:44

This is incredible! Thank you!

Are you planning on adding image support in the future? I would jump over to this from ClipClip right now if it just had image history support.

ClipClip lets me take a screenshot to the clipboard, and then copy some other things to the clipboard, and then later on I can come back and paste that image in by selecting it from my history.
User avatar
hoppfrosch
Posts: 443
Joined: 07 Oct 2013, 04:05
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

13 Feb 2020, 23:14

Thoughtfu1Tux wrote:
13 Feb 2020, 20:44
... I would jump over to this from ClipClip right now if it just had image history support.

ClipClip lets me take a screenshot to the clipboard, and then copy some other things to the clipboard, and then later on I can come back and paste that image in by selecting it from my history.
Just for information: if you are on Win10, there is an often overseen feature https://www.howtogeek.com/351978/using-windows-10s-new-clipboard-history-and-cloud-sync/
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

14 Feb 2020, 13:33

Thoughtfu1Tux wrote:
13 Feb 2020, 20:44
Are you planning on adding image support in the future?
I don't have a particular need for an image history myself, so I probably won't add it, unless there is a script that already "just works" and I can add to CL3, but I haven't seen one yet.

I've done some GDI capture clipboard tests and also tried ClipJump (also AutoHotkey) in the past, some observations:

- CJ had a tendency to store multiple copies of the same clipboard image, and I didn't like how you had to retrieve them (personal preference, CJ is a fine program)

- I use Total Commander and use the Quick Preview option a lot, for one reason or another each "quick viewed" image was also captured by CJ which is kind of annoying

- AutoHotkey / GDI can not read the Firefox image clipboard (so it won't capture right click, Copy image to clipboard afaik). It does work with Chrome, but I use Firefox.

Of course the first two are easily solved (avoid duplicate saves, ignore certain programs/actions) and perhaps there is a way to access Firefox clipboard images, perhaps via the URL which is also stored in the clipboard when you copy an image so you could simply download it and store it for example.

A useful images history viewer would have to be added so you can browse and select the one you need, although I suspect that is fairly trivial (a Gui with a listbox on the right, preview on the left).

But as I don't see myself using such images, I don't feel the urge to code it. Sorry.
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Feb 2020, 09:07

ahk7 wrote:
14 Feb 2020, 13:33
Thanks for the response, I didn't realize that there were so many headaches with storing images. I'm just going to to use CL3 for all my text based copy and pasting and then the Windows 10 Clipboard Manager for images for the moment.

I might just try my hand at adding image support to CL3 with GDIP. I actually did a little bit of research into the topic after i made my previous comment, I can borrow some code from Joe Gline's Screen Clipping tool to save images from clipboard to a file, and then i found a very old forum post about reading from an image to clipboard HERE.
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Feb 2020, 10:26

Something Else i just found: Not sure if this is a bug or a feature, but If I copy multiple files to the clipboard individually and then try to paste them into a different folder, 1 by 1, the first file will paste just fine, but the 2nd one onwards will navigate me to the folder where i copied the file from. It seems that CL3 converts the copied file into a filepath once another item is added to the clipboard.

I made a quick script to test this and it looks like ClipboardAll just contains the filepath when it is copied back to the clipboard, not a filepath to a copied file that is ready to be pasted.The clipboard manager i was using before: ClipClip (Not written in autohotkey) somehow stores the filepath so that even if i come back to it in the history later it can still paste the file to the currently open explorer window. Any thoughts on how to possibly make this work? I can think of some workarounds using filecopy or filemove and COM integration to get the filepath of the currently active explorer window, but I have no idea how to tell if the contents of the clipboard contains a filepath, or a copied file that is ready to be pasted.
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Feb 2020, 13:21

Thoughtfu1Tux wrote:
17 Feb 2020, 10:26
Something Else i just found: Not sure if this is a bug or a feature, but If I copy multiple files to the clipboard individually and then try to paste them into a different folder, 1 by 1, the first file will paste just fine, but the 2nd one onwards will navigate me to the folder where i copied the file from.
It is a feature :) Everything is text apart from maybe the current clipboard entry (that could be an image, have rich text formatting etc). So your assumption is correct. You could go with FileCopy or COM but I wouldn't do that as you have to figure out the target path as well and not all programs that would accept those solutions.

It is probably very easy to add.

Step 1: Go to this post by just me https://www.autohotkey.com/boards/viewtopic.php?p=63914#p63914 and copy the ClipboardSetFiles() function from that example script, save it as ClipboardSetFiles.ahk and place it in the "cl3\lib\" folder. That functions sets the contents of the clipboard as "files to be copied" format (or whatever its called)

Step 2: As you can see here https://github.com/hi5/CL3/blob/master/cl3.ahk#L576 we can add a optional include file that "does something" before it actually pastes. That file is not present in the repository and you have to create a file in "cl3\plugins\" yourself with the name "PastePrivateRules.ahk"

Add this code to that file

Code: Select all

If WinActive("ahk_exe explorer.exe") or WinActive("ahk_class TTOTAL_CMD") ; or etc
	{
	 ClipboardSetFiles(Clipboard)
	 Sleep 50
	}
As you can see it will see if file explorer or total commander is active and use the ClipboardSetFiles, so now when it pastes it will actually copy files vs try to paste text. You can adjust the "IF" check according to your needs.

Improvement: you could actually check if each line in the clipboard is actually a valid file path by using a Loop + FileExist and create a new variable and set that to the clipboard ClipboardSetFiles(ValidFiles)

Alternative would be to create some sort of plugin that would keep track of valid file paths added to the clipboard history (up to X entries) and call a menu with file paths only and then use ClipboardSetFiles() and paste it but it probably is less convenient and the above might already be sufficient.

Just to note PastePrivateRules.ahk will never be part of the GitHub repository so anything you add won't be overwritten if you update CL3 in the future. Here is another example of a private rule https://github.com/hi5/CL3/issues/14#issuecomment-513292998
ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Feb 2020, 13:50

Thoughtfu1Tux wrote:
17 Feb 2020, 09:07
I might just try my hand at adding image support to CL3 with GDIP.
If you want to get started:

Step 1: Grab the GDI lib from here (probably overkill but it is the lastest version):
https://github.com/marius-sucan/AHK-GDIp-Library-Compilation

Save it to cl3\lib\

Step 2: Add this to plugins\MyPlugins.ahk (create a file if it doesn't exist)

Code: Select all

 ; I copied these two funcs from clipjump if I recall correctly
Gdip_SetImagetoClipboard( pImage ){
	;Sets some Image file to Clipboard
	PToken := Gdip_Startup()
	pBitmap := Gdip_CreateBitmapFromFile(pImage)
	Gdip_SetBitmaptoClipboard(pBitmap)
	Gdip_DisposeImage( pBitmap )
	Gdip_Shutdown( PToken)
}

;Gdip_CaptureClipboard()
;	Captures Clipboard to file

Gdip_CaptureClipboard(file, quality){
	PToken := Gdip_Startup()
	pBitmap := Gdip_CreateBitmapFromClipboard()
	Gdip_SaveBitmaptoFile(pBitmap, file, quality)
	Gdip_DisposeImage( pBitmap )
	Gdip_Shutdown( PToken)
}

#include %A_ScriptDir%\lib\Gdip_All.ahk
See comments in https://github.com/hi5/CL3/blob/master/plugins/plugins.ahk for some background info

Step 3: Above line https://github.com/hi5/CL3/blob/master/cl3.ahk#L711 add this to cl3.ahk

Code: Select all

If (A_EventInfo = 2)
	{
	 Gdip_CaptureClipboard( A_WorkingDir "\ClipData\" A_Now ".png", 100) ; adjust path to preference
	 WinGet, IconExe, ProcessPath , A
	 History.Insert(1,{"text": A_Now " [image added to clipboard history]","icon": IconExe,"lines": 1})
	 Return
	}
Restart CL3 - now it should capture images and save them in the ClipData folder

Now to:
- avoid duplicates perhaps keeping track of file hashes of the images or experiment with sleep/a_tickcount to avoid saving images within a short time
- add exceptions/ignore programs (e.g. make Firefox work or prepare an "ignore list")
- create new gui to browse the images and load it back into the clipboard using Gdip_SetImagetoClipboard() (I imagine a listbox on the left, preview image on the right while you scroll up/down)
- limit the number of images to avoid very large clipboard history say a SetTimer to check if there are more as X entries and delete, or keep a list in memory and delete the oldest if you add a new one etc
User avatar
Thoughtfu1Tux
Posts: 125
Joined: 31 May 2018, 23:26

Re: CL3 clipboard utility (text only) with menu, search, quick paste, cycle/step, plugins, API, ...

17 Feb 2020, 17:31

ahk7 wrote:
17 Feb 2020, 13:21
Wow! Thanks for taking the time to write this out! I'm definitely going to add this functionality in the next couple of days.
Major kudos for that PastePrivateRules.ahk functionality. For people to be able to insert their own code snippets and still be able to download updates from your github, that is some damn good planning.

Edit: Just noticed this was released all the way in 2013. Can't believe i haven't run into it before while crawling thorugh the forum for scripts to add to my personal collection.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 114 guests