Invoke PopClip Via Keyboard Using AppleScript, Automator and OS X Services

A tweet from the PopClip developer directed me to the PopClip User Guide to take advantage of a feature I’ve been wanting in the app for some time: the ability to invoke PopClip via the keyboard.

The method uses AppleScript and the code is super simple:

tell application "PopClip" to appear

The documentation suggests using a few third-party “launcher” utility apps, but I’ve discovered a way to do so with just OS X, using Automator and OS X Services. Here’s how I did it.

First, you need to launch Automator on your Mac and choose “Service” for a new document. Drag the “Run AppleScript” action from the list over to the right side. Using the AppleScript above, configure the contents of that action as so (note the ‘no input’ selected for ‘Service receives:’):

Save the file (I named mine “PopClip – invoke”).

Next, go to the System Preferences and click the Keyboard prefs, and then the Keyboard Shortcuts tab. On the left-hand list, choose Services, and scroll down to the Text section to find your newly-created Service:

Note in the screenshot that the arrow points to the custom keyboard shortcut I assigned. You’ll need to manually do the same by clicking the gray “none” text, which will reveal an “add shortcut” button. Click that button to add the shortcut of your choice. As you can see, I chose Control-X for mine.

You may need to quit and restart open applications for the changes to take effect in each app’s Services menu.

Now you can highlight text using the keyboard, then type the Control-X combo and PopClip’s menu will appear. You can navigate the menu options with the left/right arrow keys. And because we made sure the Service had ‘no input’ chosen, you can invoke PopClip without any text selected (for pasting), but still works fine when text is selected.

17 thoughts on “Invoke PopClip Via Keyboard Using AppleScript, Automator and OS X Services

  1. Hi George,
    thanks for the post, I was looking for a way to do exactly this. Unfortunately it doesn’t seem to work for me. My script looks exactly like yours and I even chose the same shortcut. I restarted my Mac to make sure all the apps I was trying this with were restarted, but when I hit Ctrl-X nothing happens.
    Do you have any hints on why this might happen? I’m not an applescript expert.

    1. Nevermind… just found out that it DOES work in your comment box, just not where I tried before (namely: TeXShop and Notational Velocity). Kind of a bummer, considering that mouse-triggered PopClip works fine for them. Anyway, thanks again for your tip! Have a nice day.

      1. Good to hear it works now. Sometimes you need to quit and relaunch apps for Services to work. Maybe even a reboot. But some apps might not recognize the Service. Let me know what you discover after relaunch or reboot.

  2. Didn’t work in Word; shortcut showed up under “General”, rather than “Text” Keyboard shortcuts (if that matters). Never used Automator before, but followed your instructions. Any advice?

  3. I managed to get this great little tip working. At first nothing happened but I found by selecting the Service menu in an application and invoking the *popClip appear* service it worked. After that it works from the keyboard shortcut too.
    Thanks for sharing this little tip.

    1. You know, I’ve noticed that same issue with a custom keyboard shortcut I’ve added to Apple Mail. I don’t really use this PopClip tip much so never noticed. But I think this is a bug in OS X now that you bring this up. I am still on 10.8, how about you?

      1. No I am up to date on OS X as of this post 10.9.1

        But I am seeing so many bugs under Mavericks I loose track on what did work under Mountain and what doesn’t now :-)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s