Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8102859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:21:12+00:00 2026-06-05T23:21:12+00:00

I know how to copy plain text to the clipboard: oascript -e ‘set the

  • 0

I know how to copy plain text to the clipboard:

oascript -e 'set the clipboard to "plain text"'

But the question is how can I copy html contents to the clipboard?
For example, how can I copy the following html content to the clipboard:

<b>bold text</b>

so that I get bold text when I paste it in TextEdit?

Thanks for the help in advance!


I found an intermediate solution for this:

echo "<b>bold text</b>" | textutil -stdin -stdout -format html -convert rtf | pbcopy

This works, so far so good, but unfortunately I found that it doesn’t work for an image tag:

echo "<img src=\"https://www.google.com/images/srpr/logo3w.png\">" | textutil -stdin -stdout -format html -convert rtf | pbcopy

This does not do the job I want, so anybody knows the reason?
Thanks!


I’ve found a working solution and posted it below 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:21:14+00:00Added an answer on June 5, 2026 at 11:21 pm

    I’ve found a solution and the idea is to use the HTML class directly instead of the RTF class. (TextEdit or web editors can handle this HTML class as well as the RTF class data)
    All you have to do is to convert your html code into raw hexcode.
    The complete code looks like:

    hex=`echo -n "your html code here" | hexdump -ve '1/1 "%.2x"'`
    osascript -e "set the clipboard to «data HTML${hex}»"
    

    You can combine them into one sentence, of course.
    Hope this helped anybody interested. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know when you set to true ,it will shadow copy the files.But what
I've got an input so the user can type either html or plain text.
I would like to copy the value of a input:file to input:text. I can
I know how to copy an input field to something else. No prob. How
may i know how to copy xml files from rc/ to class/ when compile
I would like to know how to copy all content of a file (server.log)
Do you know any way for safe copy cut operation in Android? I want
Does anyone know of a way to copy mail attachments of a particular extention
Does anyone know of an easy way to copy a database from one computer
Does anyone know if its possible to use phing to copy an entire folder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.