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


Click here to return to the 'Don't use pbcopy' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Don't use pbcopy
Authored by: laotzu on Sep 04, '03 09:22:16AM

Python comes with a rich set of libraries, including wrappers for carbonlib. It is much nicer to use these libraries to access the pasteboard rather than pbcopy, since you can explicitly state the types of data you want to put on the board. Additionally, this way a new process does not need to be spawned. In place of the last three lines of code, use this instead:

from Carbon import Scrap
Scrap.ClearCurrentScrap()
Scrap.GetCurrentScrap().PutScrapFlavor('RTF ', 0, content)


[ Reply to This | # ]