Getting RTF data out of Mac OS X pasteboard (clipboard)

后端 未结 4 1594
温柔的废话
温柔的废话 2020-12-09 03:46

According to the man page for pbpaste,

   -Prefer {txt | rtf | ps}
          tells pbpaste what type of data to look for  in  the          


        
4条回答
  •  攒了一身酷
    2020-12-09 04:19

    It is very easy via AppleScript (tested in 10.11 El Capitan):

    set the clipboard to (the clipboard as «class RTF »)
    

    You can create a Service via Automator:

    1. open Automator
    2. make new service ("Dienst" in German)
    3. add "execute a AppleScript"
    4. input: nothing; output; replaces Selection

    The Script:

    -- name: convert to RTF
    on run {input, parameters}
        set the clipboard to (the clipboard as «class RTF »)
        return the clipboard
    end run
    

    Done. Now save the new Service and to try it out: Select a text, then go to the Application Menu and choose "Services" > "convert to RTF"

提交回复
热议问题