Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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}'
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.