Skip to content

Instantly share code, notes, and snippets.

@eruffaldi
Created January 18, 2017 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save eruffaldi/6df8e5ca2b6a50a0e4528d748992a77c to your computer and use it in GitHub Desktop.
Save eruffaldi/6df8e5ca2b6a50a0e4528d748992a77c to your computer and use it in GitHub Desktop.
pbpaste html OSX
// xcrun -sdk macosx swiftc pbpaste.swift -o pbpaste-html
// from: http://stackoverflow.com/questions/17217450/how-to-get-html-data-out-of-of-the-os-x-pasteboard-clipboard
import Cocoa
let type = NSPasteboardTypeHTML // PNG for image
if let string = NSPasteboard.generalPasteboard().stringForType(type) {
print(string)
}
else {
print("Could not find string data of type '\(type)' on the system pasteboard")
exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment