12

I am looking for a clipboard viewer for OS X which will show all formats that the clipboard is holding the data in. (I.e. something similar to the Clipbook viewer in Windows XP.)

I found a number of programs that show the contents of the clipboard, but I haven't been able to find one which lists all formats available on the clipboard at the moment, and makes it possible to extract either of them. I believe the OS X clipboard can hold the data in multiple formats simultaneously, just like Windows (e.g. in MS Word there's a Paste special... menu item which allows selecting the format to paste).

4 Answers 4

13

You can see the different types by running the clipboard as record in AppleScript Editor.

the clipboard, the clipboard as text, or Unicode text of (the clipboard as record) will return a plain text version. AppleScript still converts line endings to CR though.

2
  • 11
    $ osascript -e 'the clipboard as record' | less for a command line one-liner
    – redacted
    Aug 9, 2017 at 11:47
  • 1
    This works, but reports HTML data weirdly encoded: «class HTML»:«data HTML3C68746D6... and does not let me check the hex dump along the text easily
    – Nickolay
    Oct 8, 2020 at 5:38
4

The MacOSX developer tools come with an example app called "ClipboardViewer.app" and its source for Xcode. This is by far the most explicit clipboard exploration tool I've found for MacOSX: it shows the string of the clipboard flavour (called UTI on MacOSX) and a hex dump of the content.

Here is an example screenshot made with this app (using a Mathematica source). It would be cool if such a project could be made into an open-source project for MacOSX instead of being a dev-tool-thing. However, there's a public web-page of Apple dev support, where you can download the sample project and compile it using XCode; as of today (late 2018), one needs to let the suggested be applied such as chaning architecture from 32 to 64 bits; after this all compiles well.

example clipboard viewer usage

5
  • Where exactly can one find the ClipboardViewer.app source code?
    – tml
    Jun 28, 2018 at 7:20
  • There are links to the source and binary at superuser.com/questions/246714/…
    – Ian Dunn
    Sep 18, 2018 at 16:45
  • I added the link to the source of clipboard viewer. Thanks @ian-dunn. Nov 25, 2018 at 16:50
  • If you have an Apple ID, you can log into the Apple Developer Portal and search for it: developer.apple.com/download/more/?=clipboard%20viewer - it is part of the "Additional Tools for Xcode" bundle. Note that you don't need a paid developer account for this - the basic one works just fine May 20, 2020 at 3:56
  • 2
    I recently made a presentation about this and could not find a version that was working anymore (all the binaries I had were 32 bits and I had catalina) so I found the free clipboard viewer of langui which could do the same service. May 21, 2020 at 20:01
2

If you just want to see what types are available, you can run

osascript -e 'clipboard info' 

Example output:

«class weba», 974, «class RTF », 425, «class HTML», 604, «class utf8», 16, «class ut16», 34, string, 16, Unicode text, 32

Compare this with

osascript -e 'the clipboard as record' 

which might output a mess that doesn’t let you easily see just the types.

«class weba»:«data weba62706C6973743030D101025F100F5765624D61696E5265736F75726365D5030405060708090A0B0C5F10135765625265736F757263654D494D45547970655F101B5765625265736F7572636554657874456E636F64696E674E616D655E5765625265736F7572636555524C5F10145765625265736F757263654672616D654E616D655F100F5765625265736F757263654461746159746578742F68746D6C555554462D385F107D68747470733A2F2F6170706C652E737461636B65786368616E67652E636F6D2F7175657374696F6E732F3238313931302F6170706C657363726970742D686F772D746F2D636865636B2D69662D7468652D636C6970626F6172642D636F6E73697374732D6F662D612D66696C652D696E73746561642D6F662D74657874504F11026B3C21444F43545950452068746D6C3E3C7370616E207374796C653D2263617265742D636F6C6F723A207267622833352C2033382C203431293B20636F6C6F723A207267622833352C2033382C203431293B20666F6E742D66616D696C793A202D6170706C652D73797374656D2C20426C696E6B4D616353797374656D466F6E742C202671756F743B5365676F652055492671756F743B2C202671756F743B4C696265726174696F6E2053616E732671756F743B2C2073616E732D73657269663B20666F6E742D73697A653A20313370783B20666F6E742D7374796C653A206E6F726D616C3B20666F6E742D76617269616E742D636170733A206E6F726D616C3B20666F6E742D7765696768743A206E6F726D616C3B206C65747465722D73706163696E673A206E6F726D616C3B206F727068616E733A206175746F3B20746578742D616C69676E3A206C6566743B20746578742D696E64656E743A203070783B20746578742D7472616E73666F726D3A206E6F6E653B2077686974652D73706163653A206E6F726D616C3B207769646F77733A206175746F3B20776F72642D73706163696E673A203070783B202D7765626B69742D746578742D73697A652D61646A7573743A206175746F3B202D7765626B69742D746578742D7374726F6B652D77696474683A203070783B206261636B67726F756E642D636F6C6F723A20726762283235352C203235352C20323535293B20746578742D6465636F726174696F6E3A206E6F6E653B20646973706C61793A20696E6C696E652021696D706F7274616E743B20666C6F61743A206E6F6E653B223E436C6970626F617264205669657765723C2F7370616E3E0008000B001D0028003E005C006B00820094009E00A4012401250000000000000201000000000000000D00000000000000000000000000000394», «class RTF »:«data RTF 7B5C727466315C616E73695C616E7369637067313235325C636F636F61727466323531330A5C636F636F61746578747363616C696E67305C636F636F61706C6174666F726D307B5C666F6E7474626C5C66305C666E696C5C6663686172736574302048656C7665746963614E6575653B7D0A7B5C636F6C6F7274626C3B5C7265643235355C677265656E3235355C626C75653235353B5C72656432365C677265656E32385C626C756533313B5C7265643235355C677265656E3235355C626C75653235353B7D0A7B5C2A5C657870616E646564636F6C6F7274626C3B3B5C6373737267625C6331333732355C6331343930325C6331363037383B5C6373737267625C633130303030305C633130303030305C633130303030303B7D0A5C6465667461623732300A5C706172645C7061726465667461623732305C7061727469676874656E666163746F72300A0A5C66305C66733236205C636632205C636233205C6578706E64305C6578706E647477305C6B65726E696E67300A5C6F75746C305C7374726F6B65776964746830205C7374726F6B65633220436C6970626F617264205669657765727D», «class HTML»:«data HTML3C7370616E207374796C653D2263617265742D636F6C6F723A207267622833352C2033382C203431293B20636F6C6F723A207267622833352C2033382C203431293B20666F6E742D66616D696C793A202D6170706C652D73797374656D2C20426C696E6B4D616353797374656D466F6E742C202671756F743B5365676F652055492671756F743B2C202671756F743B4C696265726174696F6E2053616E732671756F743B2C2073616E732D73657269663B20666F6E742D73697A653A20313370783B20666F6E742D7374796C653A206E6F726D616C3B20666F6E742D76617269616E742D636170733A206E6F726D616C3B20666F6E742D7765696768743A206E6F726D616C3B206C65747465722D73706163696E673A206E6F726D616C3B206F727068616E733A206175746F3B20746578742D616C69676E3A206C6566743B20746578742D696E64656E743A203070783B20746578742D7472616E73666F726D3A206E6F6E653B2077686974652D73706163653A206E6F726D616C3B207769646F77733A206175746F3B20776F72642D73706163696E673A203070783B202D7765626B69742D746578742D73697A652D61646A7573743A206175746F3B202D7765626B69742D746578742D7374726F6B652D77696474683A203070783B206261636B67726F756E642D636F6C6F723A20726762283235352C203235352C20323535293B20746578742D6465636F726174696F6E3A206E6F6E653B20646973706C61793A20696E6C696E652021696D706F7274616E743B20666C6F61743A206E6F6E653B223E436C6970626F617264205669657765723C2F7370616E3E», «class utf8»:Clipboard Viewer, «class ut16»:Clipboard Viewer, string:Clipboard Viewer, Unicode text:Clipboard Viewer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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