Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Modify Cocoa apps to support paste as plain text System
Mac Geekery posted a great hack on how to edit most any Cocoa program to support the ability to paste as plain text (no fonts, no attributes, just the text). The example used is hacking iChat so that when you copy/paste from a web page in Safari, the text is readable on the other end, but there are myriad uses for this in other Mac programs.

It does require the Developer Tools, but it's a really simple change (just adding one menu item, and there's a walkthrough).
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,167 views]  

Modify Cocoa apps to support paste as plain text | 18 comments | Create New Account
Click here to return to the 'Modify Cocoa apps to support paste as plain text' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Modify Cocoa apps to support paste as plain text
Authored by: Xeo on Oct 07, '04 12:25:38PM

This is a fantastic hint. Being able to add that is really cool.

Worked great for me on iChat, which is one of the places I run into this problem most often.



[ Reply to This | # ]
PlainClip, an app to paste as plain text
Authored by: MtnBiker on Oct 07, '04 12:49:36PM

Plain Clip 1.0.5
http://www.bluem.net/downloads/plain-clip_en/

The following is from the ReadMe with heavy editing.

Plain Clip is a small faceless application that removes formatting from text which is on the clipboard. Trigger it using a hotkey application ( "Spark", but of course you can also use "iKey" or any other application that accomplishes the same task):Copy some text, press your hot key (which tells "Spark" to launch Plain Clip) and half a second later the job is done.

---
Hermosa Beach, CA USA



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: Mikey-San on Oct 07, '04 07:16:57PM

Why hack your apps?

Hop into a text editor and pen this script:

#!/bin/sh
pbpaste | pbcopy

Add it to your Script Menu via the ~/Library/Scripts folder, and viola! This script converts the contents of the clipboard to plain text.



[ Reply to This | # ]
sh script?
Authored by: airdrummer on Oct 07, '04 08:58:32PM

did that, also chmod'd a+x, but all it does is open the script in the editor...

what am i missing here?



[ Reply to This | # ]
it's worse...
Authored by: airdrummer on Oct 07, '04 09:05:28PM

script menu alert:

Error: Couldn't execute the tool /Users/tomw/Library/Scripts/pasteAsPlainText.sh; errno is 2 (No such file or directory).

but here it is:

tomsPbook:~/Library/Scripts tomw$ ls -l
total 16
-rwxr-xr-x 1 tomw staff 26 7 Oct 20:54 pasteAsPlainText.sh

wtf???



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: fxt on Oct 08, '04 01:44:57AM

you have to wrap this in applescript for this to work in your ~/Library/Scripts. do shell script "pbpaste | pbcopy"

fxt



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: echo on Oct 08, '04 02:00:39AM

This does work. It does what the author says, it converts the contents of the clipboard to plain text. Then you have to follow with a second step to paste.

I copied the script, named it with a .sh extension, and did a chmod +x and placed it in ~Library/Scripts/

I'm still watching here for a non hacking solution that will paste in the same step.



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: pozytron on Oct 08, '04 02:39:06AM
The SIMBL plugin I created is not a hack. It doesn't actually modify any of your applications. Removing the plugin will restore your programs.

Don't mean to toot my own horn, sorry, I just wanted to clarify :)

Cheers,
Robin

[ Reply to This | # ]

Modify Cocoa apps to support paste as plain text
Authored by: afb on Oct 08, '04 05:51:02PM

then give it a shortcut like command+control+v with menu master!

---
now is the time for all good cows to come to the aid of their pasture.



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: tnagpal on Oct 07, '04 07:31:43PM

Rather than a service, I would rather see a contextual menu item with a paste as plain text option..



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: pozytron on Oct 08, '04 12:03:53AM
Inspired by this hint, I went and wrote a SIMBL plugin to do this in all (well, actually, most) Cocoa apps automatically. You can get it at http://www.pozytron.com/plaintextpaste.

I hope someone finds this useful!

Cheers,
Robin

[ Reply to This | # ]

Modify Cocoa apps to support paste as plain text
Authored by: gedalin on Oct 08, '04 01:25:05AM

The plugin is not downloadable.



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: pozytron on Oct 08, '04 02:05:10AM
Sorry! A stupid capitalization mistake—it's fixed now, along with the rest of the page.

Cheers,
Robin

[ Reply to This | # ]

Modify Cocoa apps to support paste as plain text
Authored by: gaudior on Oct 08, '04 12:09:07PM

I already use PithHelmet, which uses SIMBL. If I install yours, will it hose PithHelmet, or is your installer smart enough not to clobber the existing SIMBL installation?



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: pozytron on Oct 08, '04 03:18:59PM

PithHelmet and other SIMBL plugins (including AcidSearch) should be unaffected.

Cheers,
Robin



[ Reply to This | # ]
Related hint
Authored by: echo on Oct 08, '04 03:19:06AM
Modify Cocoa apps to support paste as plain text
Authored by: ptwithy on Oct 08, '04 12:29:32PM

You Control's clipboard history tool let's you choose the format you want to paste in. Not free, but probably a good substitute for the non-geek.



[ Reply to This | # ]
Modify Cocoa apps to support paste as plain text
Authored by: mclasen on Oct 10, '04 01:28:25AM

don't suppose this would work with Filemaker 7?

---
+--------------------------------------------------------+
Michael A Clasen
macc@mclasen.com
http://www.mclasen.com
+---------------------------------------



[ Reply to This | # ]