Title

Message

Confirm

<< DiscussionsReply

Use custom hotkeys to insert pinned clips?

hoja
30 discussion posts
Hi All,
I'm a long time happy Display-Fusion user, now checking out Clipboard-Fusion, for a likely somewhat unusual purpose: I would like to use the Clipboard Tool to (kind of) remap a few keys on my keyboard. To clarify: I would like map key presses which so far aren't in use.
So far, I didn't find a keyword-remapper which worked without hiccups on non-Qwerty keyboards and I thought I could simply store these characters in the clipboard, along with a few other text-snippets I often use.
I'm on a German Keyboard and sometimes use a Laptop without a Num-Block. On the Laptop in particular it can be pretty clumsy to type a few characters for this em dash I even need to resort to the Emoji Popup (none of the usual key-combos works), which is far too slow for my taste.
Long story short: Is there a way to freely assign keyword shortcuts to individual pinned clipboard entries in Clipboard Fusion (as doable in Ditto)? So far, I only saw the number keys with a Modifier, which doesn't appear ideal for my particular case (the minus key with Ctrl+Shift or similar made more sense).
Thanks for any input!
May 6, 2021 (modified May 6, 2021)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You could create a Macro that runs this command:

BFS.Clipboard.PasteText(BFS.ClipboardFusion.GetLocalPinnedText(0));


The 0 would be the first pinned item, so you can change it from there (e.g. 1 for the second item, 2 for the third item).

You can then assign key combinations to the Macros.

Hope that helps!
May 7, 2021  • #2
hoja
30 discussion posts
Thank you! I will try this out. This technique is limited to 10 entries (for the number-keys), correct? Is the expected workflow to bring up the clipboard manager and to chose entries from the list – or is there a way to access > 10 clips via keyboard-shortcuts?
May 9, 2021  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You can create as many Macros as you like, and set whatever key combination you want on them
May 10, 2021  • #4
hoja
30 discussion posts
Sounds good. Just made the purchase and will check out these options soon!
May 12, 2021  • #5
hoja
30 discussion posts
Problems with shortcut-assignment
I have now created a few Macros which insert pinned special characters with keyboard shortcuts. I inserted the snippet you shared in the "your code goes here" position and validation threw no errors – but I still may have messed up (see screenshot).
Pressing the hotkey-combos does nothing here. Sometimes, I saw a tray pop-up which confirmed running macro[name] but nothing got inserted.
Then I downloaded a few premade macros (which likely have no errors) and assigned keyboard shortcuts. I tried Linkify Selection and followed the flow in description. Pressing the hotkey-combos does nothing here. Sometimes, I saw a tray pop-up which confirmed running macro[name] but nothing happened.
Then, just for testing I downloaded a few premade macros (which likely have no errors) and assigned keyboard shortcuts too. I tried Linkify Selection and followed the flow in description. Inserting via Hotkey didn't work, but I couldn't even insert from the Macro Tab in the Clipboard Manager. I had a URL in the Clipboard, selected text in my E-Mail app and clicked the Macro. No avail.
I also downloaded Convert Text to Title Case (Smart) and assigned a Hotkey-combination. Again, the assigned keys do nothing, but this time I could run the macro from the macro tab (by clicking its entry).

Not sure, if relevant:
The Keyboard is German (quertz), the OS is Win 10 English, regional settings are German.
• Attachment [protected]: 2021-05-12_16h01_21.png [62,053 bytes]
May 12, 2021 (modified May 12, 2021)  • #6
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Strange, it works fine when I test it here. Could you attach a screenshot of one of the macros you created?
May 12, 2021  • #7
hoja
30 discussion posts
Quote:
Strange, it works fine when I test it here. Could you attach a screenshot of one of the macros you created?

Here is one. It is supposed to call a single special character which is pinned. I likely messed up – but I generally seem to have troubles with running CF-Macros from hotkeys. Does the Linkify macro from the default library work on your end, when you assign a macro keyboard shortcut?
Thanks for your support!
• Attachment [protected]: 2021-05-12_20h02_24.png [51,279 bytes]
May 12, 2021 (modified May 13, 2021)  • #8
Keith Lammers (BFS)'s profile on WallpaperFusion.com
The Linkify macro works, yep, but note that macro doesn't automatically paste. It sets the clipboard and then you need to manually paste the text.

Your macro in the screenshot has some extra text that shouldn't be there. Deleting the "//
" from the start of line 15 and the "
" from the end of that line should fix it up.
May 14, 2021  • #9
hoja
30 discussion posts
Quote:
The Linkify macro works, yep, but note that macro doesn't automatically paste. It sets the clipboard and then you need to manually paste the text.

  • I read the command sequence (you first need the desired link text in the clipboard, then you select the target item, then press hotkeys to invoke the Macro). Windows shows me via tray pop-up that the command fired, but nothing happens to the target text (ran it in Thunderbird and Notion which both can deal with links). Anyway, I don't need this particular Macro, I just wanted to use it as a safe test case for keyboard shortcut assignment.

  • I now understand. First run the Macro, then paste the result onto the still highlighted target. A somewhat convoluted flow, but it works now.
    Quote:

    Your macro in the screenshot has some extra text that shouldn't be there. Deleting the "//
    " from the start of line 15 and the "
    " from the end of that line should fix it up.

    Sorry for that. I'm not a coder . The Macro now looks as in the attached screenshot, I get a tray pop-up that the macro was run, but still I don't get an em dash inserted.
    • Attachment [protected]: 2021-05-14_14h36_33.png [41,333 bytes]
    May 14, 2021 (modified May 14, 2021)  • #10
    hoja
    30 discussion posts
    Solved. After correcting the code I could finally insert pinned entries via keyboard. But the sequence numbers didn't work. To insert the first pinned clip I have to address clip O.
    • Attachment [protected]: 2021-05-14_15h07_50.png [35,959 bytes]
    May 14, 2021  • #11
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Glad to hear you were able to get it working! That's correct as well, the array is 0-based, so item 1 in the list is actually item 0 behind the scenes.
    May 14, 2021  • #12
    hoja
    30 discussion posts
    Quote:
    Glad to hear you were able to get it working! That's correct as well, the array is 0-based, so item 1 in the list is actually item 0 behind the scenes.

    Thanks for your help, Keith! Two thoughts: If the array starts with 0, why not also start counting clips at 0? Or use another unique identifier? I'm not saying that it took me ages to track down the error, but I'm sure you could avoid that I make this mistake in the first place
    I realize that my current use-case (in the sense of extending the keyboard with some obscure letters)is likely not typical... but what felt quite awkward in this context is, that CF inserts its clips when letting go the keys (OnKeyUp, if this is a word).
    I guess this is not a problem if one wants to pick clips visually (by using the Clipboard Manager). If one prefers running apps with keyboard shortcuts only, getting the clip inserted after letting the keys go feels too late, laggy, even somewhat broken. This doesn't match the typical typing experience – I don't like it. Is there a secret switch to change the timing for the paste-operation?
    PS: Meanwhile I tested a variety of "normal" Copy / Paste operations. They all fire OnKeyDown.
    May 15, 2021 (modified May 15, 2021)  • #13
    hoja
    30 discussion posts
    Just a friendly bump . Did you see my last answer? Inserting the clip while the key is down was great.
    May 19, 2021 (modified May 19, 2021)  • #14
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Sorry, I'm a bit backed up on support cases over here

    I've checked in with our developers, and the reason we wait for keyup with macros is because macros can send keystrokes, and if the keys are still down when the happens, it can interfere.

    For example, let's say your macro wants to send some keystrokes in lower case, but your hotkey is set to Ctrl + Shift + 1. If the macro starts running on keydown, and it starts sending those keystrokes, some of the keystrokes may end up in upper case, because the Shift key was still down when it started.
    May 20, 2021  • #15
    hoja
    30 discussion posts
    Quote:
    Sorry, I'm a bit backed up on support cases over here
    I've checked in with our developers, and the reason we wait for keyup with macros is because macros can send keystrokes, and if the keys are still down when the happens, it can interfere.
    For example, let's say your macro wants to send some keystrokes in lower case, but your hotkey is set to Ctrl + Shift + 1. If the macro starts running on keydown, and it starts sending those keystrokes, some of the keystrokes may end up in upper case because the Shift key was still down when it started.

    Thanks, that makes sense Keith – in case Shift is involved. The same logic isn't valid, with the other Modifiers or any combination of them. And – isn't there a way for you to cancel the Uppercase-Mapping, as soon as other Modifiers are involved?
    This at least does work for Keyboard Shortcuts in other applications, such as Photoshop. Upon pressing Ctrl + Shift + N and on KeyDown Photoshop gives me their New Layer dialogue. One could counter that Photoshop doesn't expect text input by default, but rather brush strokes etc. – but the same works when their text-tool is active. So with the text tool active, they do distinguish between Shift + Letter and Shift + other Modifiers + letter.
    Maybe you could tweak this behaviour?
    It's no petitesse – such details have great impact on perceived snappiness. If input appears earlier, that's always a good thing.
    May 21, 2021 (modified May 21, 2021)  • #16
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    I see what you're saying, but with Photoshop, that's an app level hotkey, so the hotkey and all of its actions are being handled with Photoshop itself.

    We're dealing with global hotkeys, and macros that are sending input to whatever app has focus, so we can't assume that the modifiers + input won't cause some adverse reactions in the app.

    Even taking Notepad for example:
    • Your macro types some text that has the letter S in it
    • The hotkey for the macro is set to Ctrl + Something
    • You press the hotkey and that letter S gets sent before you've let go of the Ctrl key
    • Notepad ends up opening the Save dialog because it saw the Ctrl + S
    May 26, 2021 (modified May 26, 2021)  • #17
    hoja
    30 discussion posts
    Hi Keith,
    thank you for the additional insight – I hadn't thought that parts of the snippet could register as one of the keypresses in a keyboard-shortcut. I hate to admit, that inserting the clip on OnMouseUp is a cheap and very clever way to deal with that problem.
    That said,  to me, this late execution still doesn't feel right
    I wonder if one couldn't somehow encapsulate clipboard-text in a way that apps can't simply extract the first letter they see fit, to execute some unexpected action.
    May 27, 2021 (modified May 27, 2021)  • #18
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    No worries! There isn't a way to do that as far as I know, but if we come across a way in the future, we'll definitely let you know

    Thanks!
    May 27, 2021  • #19
    hoja
    30 discussion posts
    Thanks! What could already feel much nicer was when it was enough to let go the letter key while still holding the Modifiers down. You force this sequence of actions: First press Modifiers, then the Letter or Number key, otherwise nothing will happen. Actually, even when doing everything correctly still nothing will happen (...)
    You have to first release all the keys involved. Then the Macro is run.
    Isn't there a least a chance to bring forward running the Macro to the point in time when the user lets go the letter/number key? Or does this still collide with something?
    May 28, 2021 (modified May 28, 2021)  • #20
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    The problem isn't that the letter is held while the macro is running, the problem is that the modifier key being held while the macro is running can cause issues. So we wait until all keys are released before running it.
    May 28, 2021  • #21
    hoja
    30 discussion posts
    Of course.
    • Attachment [protected]: imgbin-hair-trichotillomania-emoji-crazy-9PxA9xbg3uph5uCEkbzYktxy1.jpg [82,563 bytes]
    May 28, 2021  • #22
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    If we could add an advanced setting to force macros to run on keydown, with the caveat that it could interfere with any macros that use SendKeys, would that be useful for you? If so, I'll add it to our feature request list
    Jun 1, 2021  • #23
    hoja
    30 discussion posts
    Hi Keith,
    sorry for my late reply – I wanted to think about it first and then there were some other distractions Thanks a lot for this offer!
    Generally, putting this into Advanced Settings would not ruin things for others. But making this a global toggle could limit me – in case that I want to run advanced community shared Macros. Placing this control in the Hotkey assignment pop-up let you decide on a per-Macro basis – but one needed to extend the Pop-up a bit and offer some explanation. Users who prefer running Macros using the Clipboard Manager GUI are unaffected.
    For starters, sneaking in this advanced setting sure made sense – so that you guys see for yourselves that inserting text at Mousedown feels more natural
    Jun 3, 2021  • #24
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Unfortunately we wouldn't be able to make it a per-macro thing, it would have to be global.
    Jun 4, 2021  • #25
    hoja
    30 discussion posts
    Quote:
    Unfortunately we wouldn't be able to make it a per-macro thing, it would have to be global.

    Ok, understood. I would like to try out this advanced setting – but please don't spend hours on this. I'd greatly prefer running Clipboard-based actions on MouseDown already – but a global Toggle which inevitably will cause conflicts is no "proper" solution.
    Jun 8, 2021  • #26
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Ok, we'll give it a go then, I think it's a fairly simple thing to add.
    Jun 8, 2021  • #27
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Ok, turns out we don't actually need to add it! It's already setup to wait for keyup only when needed, which is when a macro contains anything that sends input (sendkeys, mouse clicks, etc).
    Jun 16, 2021  • #28
    hoja
    30 discussion posts
    Hmm. My "Macros" which insert special characters (or combinations of them) are really as silly as it gets: GetLocalPinnedText(#)).
    I want to avoid holding Alt and typing obscure number codes for simple stuff like • – ‹→ ... I type it once and then Let CF run the pinned clip. Any of my letter insertions, however, are executed as soon as you let go the mapped key.
    Maybe there's a better way to do this anyway – but I prefer keyboard entry (no picking from Clipboard Manager).
    Jun 17, 2021 (modified Jun 17, 2021)  • #29
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    Does your macro have a PasteText action as well? That sends a Ctrl + V, so it has to wait for keyup.
    Jun 17, 2021  • #30
    hoja
    30 discussion posts
    Quote:
    Does your macro have a PasteText action as well? That sends a Ctrl + V, so it has to wait for keyup.

    Yup.
    BFS.Clipboard.PasteText(BFS.ClipboardFusion.GetLocalPinnedText(0));
    Is there an easy way to circumvent pasting text (and consequently having to wait for KeyUp)? The em dash created with this simplistic Macro is created by Left Alt+150 on the numeric keyboard. Can I paste Alt+150 (which hardly should count as text) and make it register on KeyDown already?
    Jun 17, 2021 (modified Jun 17, 2021)  • #31
    Keith Lammers (BFS)'s profile on WallpaperFusion.com
    There isn't a way to get text into an app without pasting or doing SendInput/SendKeys as far as know, all of which require us to wait for keyup. Sorry!
    Jun 17, 2021  • #32
    Was this helpful?  (1)  
    << DiscussionsReply