根据man
页面pbpaste
,
-Prefer {txt | rtf | ps}
tells pbpaste what type of data to look for in the pasteboard
first. As stated above, pbpaste normally looks first for plain
text data; however, by specifying -Prefer ps you can tell
pbpaste to look first for Encapsulated PostScript. If you spec-
ify -Prefer rtf, pbpaste looks first for Rich Text format. In
any case, pbpaste looks for the other formats if the preferred
one is not found. The txt option replaces the deprecated ascii
option, which continues to function as before. Both indicate a
preference for plain text.
但是(至少根据我对 10.6 Snow Leopard 的经验),pbpaste -Prefer rtf
即使 RTF 数据存在于粘贴板上,也永远不会放弃。有没有其他简单的方法来获取准备粘贴的任何内容的 RTF 文本?
我尝试了 AppleScript,但给出了Hex 编码 craposascript -e 'the clipboard as «class RTF »'
的响应。AppleScript 可以将此十六进制数据转换为我可以使用的文本吗?«data RTF 7B
7D»