3

Is there a Mac OS X service that takes clipboard data and pastes it as plain text? Or an easy way to create one?

4

A couple options, gleefully swiped from Mac OS X Hints:

Applescript, converting pasteboard contents to plain text and pasting:

tell application "Finder" to set frontApp to (name of 1st process whose frontmost = true)
tell application frontApp
    activate
    set clip to «class ktxt» of ((the clipboard as text) as record)
    tell application "System Events" to keystroke "v" using {command down}
end tell

Shell script, save it in your Scripts folder and chmod 755

#!/bin/sh
pbpaste | pbcopy
osascript -e 'tell application "System Events" to keystroke "v" using {command down}'
  • Thanks for the info. Is there any way to convert the AppleScript to a service in Automator which takes in no input and prints out the text instead of sending Command-V? I'm trying to do this myself, but I'm getting several bugs in the code. – Senseful Feb 25 '11 at 17:17
  • I was able to get it to work by converting the shell script to an Automator Service. I was never able to get the AppleScript to work in the same way. – Senseful Feb 25 '11 at 17:36

You must log in to answer this question.

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