• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Clipboard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clipboard


  • Subject: Re: Clipboard
  • From: Jon Pugh <email@hidden>
  • Date: Mon, 26 Mar 2012 20:08:54 -0700

On Mar 26, 2012, at 3:40 PM, theDaniel wrote:
How can I find if there is something on the clipboard in SL and Lion?

The command “clipboard info” tells you what types are available on the clipboard and what sizes they are.  You can also ask for specific types and get back the info for the data of that type.

clipboard info for Unicode text

All three of the clipboard commands are implemented as scripting additions and the “clipboard” property is not typically implemented by any applications.  Nevertheless, the clipboard commands all use “the clipboard” so that an application property could avoid the “the” and peacefully coexist, like in BBEdit.

clipboard info [for <type>]
the clipboard [as <type>]
set the clipboard to <anything>

Most applications copy multiple representations of the selected data to the clipboard, allowing receiving applications to choose the best type for their needs.  That’s why it’s very handy to be able to specify which data type you want to deal with in your scripts.

An interesting technique that I use is the simple shell script: “pbpaste | pbcopy” which basically strips the clipboard of everything except text (in utf8 and utf16 flavors, apparently).  If you do this at the beginning of your script, you will remove any images.

do shell script "pbpaste | pbcopy"

This can be used to remove styles as well as images.

Jon

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Clipboard (From: theDaniel <email@hidden>)

  • Prev by Date: Re: Clipboard
  • Next by Date: Re: Clipboard
  • Previous by thread: Re: Clipboard
  • Next by thread: Handle Flash objects in Safari
  • Index(es):
    • Date
    • Thread