Looking for "Clipboard to HTML" osax


I’m looking for an old osax called “Clipboard to HTML” by Sal Soghoian. It is no longer available from the original depository site on “users.aol.com.”

Any help would be greatly appreciated.


I don’t know where you will find it, but you can instead use textutil with do shell script, or if you’re running 10.9, it’s simple enough in an ASObjC-based library.


Thanks for your reply. But I need to run it on OS 9.

I don’t think that was an osax. I think it was a script by Apple.

It was a scripting addition, although Sal didn’t write it (Donald Olson did).

See a slice of history: archive.today/B161Q

Interesting scripting addition.

FYI, here’s an ASObjC-based script library solution:

use framework "Foundation"
use framework "AppKit"
on turnStyledClipIntoHTML()
	-- get styled text off clipboard as NSAttributedString
	set theNSPasteboard to current application's NSPasteboard's generalPasteboard()
	set thestyledTextNSArray to theNSPasteboard's readObjectsForClasses:({current application's NSAttributedString}) options:(missing value)
	set theNSAttributedString to thestyledTextNSArray's objectAtIndex:0
	-- convert to HTML
	set anNSDictionary to current application's NSDictionary's dictionaryWithObject:(current application's NSHTMLTextDocumentType) forKey:(current application's NSDocumentTypeDocumentAttribute)
	set theData to theNSAttributedString's dataFromRange:{location:0, |length|:(theNSAttributedString's |length|())} documentAttributes:anNSDictionary |error|:(missing value)
	-- convert data to string
	set theHTML to current application's NSString's alloc()'s initWithData:theData encoding:(current application's NSUTF8StringEncoding)
	-- put HTML on clipboard
	theNSPasteboard's clearContents()
	theNSPasteboard's writeObjects:{theHTML}
end turnStyledClipIntoHTML

Glad to hear that there are still AppleScripters out there who likes scripting additions.

Yeah, scripting additions are easy for the user, but it was written :), not so easier for the programmer. I like Shane’s approach. Once you enter that in your library then it’s there for future use.