How to get HTML data out of of the OS X pasteboard / clipboard?

后端 未结 2 1613
醉梦人生
醉梦人生 2020-12-28 20:28

I do have to send a report regarding pasting some clipboard content into a web rich editor and I need a way to dump/restore the clipboard content to (probably) HTML.

2条回答
  •  半阙折子戏
    2020-12-28 21:19

    I realise you've already found this, but for the benefit of people who turn up here from Google, the solution given for RTF data at Getting RTF data out of Mac OS X pasteboard (clipboard) works fine for getting HTML out of the clipboard, too.

    That is, the command

    osascript -e 'the clipboard as «class HTML»' |   perl -ne 'print chr foreach unpack("C*",pack("H*",substr($_,11,-3)))'
    

提交回复
热议问题