3

How could I create a new keyboard shortcut to merge other shortcuts?
In particular I would like to merge ⌘ CommandC, ⌘ CommandF, ⌘ CommandV (Copy, Find and Paste) - would be useful for instance for Safari.

(a quick way could be automator, but I don't have much experience...maybe this post could help?)

A good example would be the use selection for find (⌘ CommandE) feature that exists in preview.

Thanks for your help.

5
  • From what you described, it would copy a selection, find that selection, and then paste that selection. What exactly would this function do other than find instances of itself and paste over it? What exactly are you trying to accomplish?
    – Allan
    Jan 19 '17 at 13:09
  • @Allan in Safari it would find other instances of a word on the page
    – dwightk
    Jan 19 '17 at 13:37
  • That's not what you described - it's what you thought it would do but not what you pseudo coded. That's why I asked the question - what specifically do you want to accomplish?
    – Allan
    Jan 19 '17 at 13:56
  • 1
    @dwightk got my point ;)
    – jjrr
    Jan 19 '17 at 15:10
  • @Allan, you'd have to click the right arrow to get to an instance of the word, but in Safari, those exact keystrokes would put highlighted text into the find field. jjrr described exactly what he wanted to do.
    – dwightk
    Jan 19 '17 at 17:47
2

I have found a funny way to do this with Karabiner installed.

Add this to your private.xml:

<?xml version="1.0"?>
<root>
    <item>
        <name>Command sequence</name>
    <item>
        <name>Option-R</name>
        <identifier>remap.option_r2command.cfv</identifier>
        <autogen>
        __KeyToKey__
        KeyCode::OPTION_R,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::C, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::F, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::V, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        </autogen>
    </item>
    </item>
</root>

Then enable it in Change Key > command sequence > Option-R

enter image description here

A single key press on the right option key will evoke the cascade of command-C/F/V shortcuts.


This doesn't work in Sierra (because Karabiner still isn't Sierra compatible) and depending on the responsiveness of your app you may have to adjust VK_WAIT_100MS to higher values like VK_WAIT_300MS. You can alternatively use other usually rarely used keys like shift_r. A shortcut like alt_r/opt_rX should also work.

If you want to use alt_r/opt_rX as "shortcut" private.xml should look like this:

<?xml version="1.0"?>
<root>
</item>
    <item>
    <name>Command sequences</name>
    <item>
        <name>Option_R-X to Command-C/F/V</name>
        <identifier>remap.option_r-x2command.cfv</identifier>
        <autogen>
        __KeyToKey__
        KeyCode::X, ModifierFlag::OPTION_R,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::C, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::F, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::V, ModifierFlag::COMMAND_L, KeyCode::VK_WAIT_100MS,
        </autogen>
    </item>
    </item>
</root>
1
  • thanks for your answer, but unfortunately I cannot try as I have sierra - unfortunately I cannot upvote yet your answer :)
    – jjrr
    Jan 19 '17 at 17:13
1

So, I found a solution by creating an applescript with automator:

on run {input, parameters}
tell application "System Events"
    key code 8 using command down
    delay 0.1
    key code 53
    key code 3 using command down
    key code 9 using command down
end tell
return input
end run

that does his job.

(the reason why there is the escape key - key code 53 - is that I was looking for a solution that works also for for jupyter notebook)

ps: the problem is still to find a shortcut that had no conflict...

1
  • (it's working in safari and firefox)
    – jjrr
    Jan 19 '17 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .