News:

Welcome to our NEW forum! We invite you to sign up today
so it can grow to be a valuable resource to all Toolbox users!

Main Menu

Hotkey-based clipboard access

Started by oblivion, February 04, 2026, 04:59:30 AM

Previous topic - Next topic

oblivion

Assuming you use Toolbox's clipboard history, you might find this useful: a slightly more automated way to get at Toolbox's clipboard. It works best on a hotkey.

Usage: in your editing window -- like now, for instance -- invoke the script, it asks for text to find in the clipboard, then presents the Toolbox clipboard pane filtered by your text. (If you just press Enter, you get the full clipboard history.) Cursor or click to the entry you want, press enter or double-click to copy that entry to the clipboard, then press the Esc key to close Toolbox and paste your chosen entry to the cursor position.

If you've invoked it by accident or change your mind about pasting something, just press Esc.

I'm using it now, to paste the current version of the code in. Nothing up my sleeves. Just to prove it to myself, this line will be in the clipboard before I do it.

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Clipboard: Clear all content ""
0002 Alert: Set the default text to "blank$"
0003 Alert: Ask for a line of text "Search clipboard for..."
0004 Action: Do next step if "alert$=blank$"
0005  String: Assign "none"
0006 Action: Do next step if "alert$<>blank$"
0007  String: Assign "alert$"
0008 Toolbox: Filter clipboard list with "string$"
0009 Toolbox: Show the tab named "Clipboard"
0010 Wait: For keypresses or mouse clicks "{esc}"
0011 Action: Do this block if "clip$<>blank$"
0012  Wait: For milliseconds to pass "200"
0013  Keyboard: Paste ""
0014 Action: End of block ""
(End)

A couple of things to note: this works better for keyboard warriors. If you choose a clipboard entry with the mouse, even if you double-click it to copy it to the clipboard, it won't paste anything if you forget yourself and close the Toolbox with the X button. Although you can still hit ^V to paste your choice in.

Also, invoking the script clears the clipboard at the start, to ensure that a choice not to pick something doesn't do something unexpected. I thought about preserving the current content of the clipboard at the top but since Toolbox is doing that anyway, I figured it was unnecessary.


oblivion

#1
I have a new version of the above.

Some new understanding of the way the clipboard functionality in the toolbox works has meant I've changed the internal logic somewhat.

So you still get prompted for a search, and leaving that blank will list the entire clipboard with default settings.

Entering a number will produce a list of the newest n lines of the clipboard rather than searching for the number itself.

On exit, the routine resets the clipboard to defaults: no active filter and the newest 100 lines listed.

It also makes sure that it pastes into the window it was invoked from, with the aid of a couple of short delays to allow Windows to catch up.

(Start)
HOW TO USE: Copy from Start to End, and then paste into an action.
REFERENCE : See an example of pasting at alomware.com/paste.png
0001 Action: Allow failure messages "0"
0002 Window: Assign active ""
0003 Clipboard: Clear all content ""
0004 Alert: Set the default text to "blank$"
0005 Alert: Ask for a line of text "Search clipboard for..."
0006 Action: Do next step if "alert$=blank$"
0007   String: Assign "none"
0008 Action: Do this block if "alert$<>blank$"
0009   Action: Do next step if "alert$="0""
0010   String: Assign "/100"
0011   Action: Do next step if "alert$>0"
0012   String: Assign "/alert$"
0013   Action: Do next step if "string$=blank$"
0014   String: Assign "alert$"
0015 Action: End of block ""
0016 Toolbox: Filter clipboard list with "string$"
0017 Toolbox: Show the tab named "Clipboard"
0018 Wait: For variable to change "toolbox$"
0019 Wait: For milliseconds to pass "500"
0020 Window: Activate for use ""
0021 Action: Do this block if "clip$<>"""
0022   Macro: Type keys or use mouse "{z200}{ctrldown}{z200}v{z200}{ctrlup}{z200}"
0023 Action: End of block ""
0024 Toolbox: Filter clipboard list with "none"
0025 Toolbox: Filter clipboard list with "/100"
0026 Window: Activate for use ""
(End)

One thing: the numeric search (unlike text searches) doesn't leave the cursor where it'd need to be for the user to cursor into the results list, so it's not yet quite as keyboard-friendly as I'd like. Not sure whether that's a Toolbox issue, or a "me" one :)

Also, if you actually want to search for a number rather than have that number produce a list of the specified length, just surround the number in quotes.

I may yet make more improvements to this but it's usable as is.

If anyone's interested enough -- please do say if you are! -- I'd be happy to break the routine down to explain what it's doing.

Paul (Lead Developer)

Hi oblivion,

Step 10 (String: Assign ""/100"") looks wrong because it's got 2 x sets of double-quotes at both ends. That would mean you're trying to filter the list with the literal text of "/100" instead of setting the list to show the last 100 items. I think you want step 10 to be like this (or am I wrong?):

0010  String: Assign "/100"
Quote from: oblivion on February 25, 2026, 06:33:01 PMthe numeric search (unlike text searches) doesn't leave the cursor where it'd need to be for the user to cursor into the results list, so it's not yet quite as keyboard-friendly as I'd like.

Ah, the Clipboard list doesn't get the focus after a "/#" filter is applied. Is that what you mean? I'll fix that for the next update. :)

oblivion

Quote from: Paul (Lead Developer) on February 25, 2026, 09:08:56 PMHi oblivion,

Step 10 (String: Assign ""/100"") looks wrong because it's got 2 x sets of double-quotes at both ends.

Oh. So it has.

Sorry; I'll fix it.

QuoteAh, the Clipboard list doesn't get the focus after a "/#" filter is applied. Is that what you mean? I'll fix that for the next update. :)

Oh, fab :) Thanks!