I’ve got an application that uses a Dynamic Type Identifier when you copy certain type of data. The actual data is XML, but the app doesn’t label it that way in the clipboard.
I’m able to read it out, but I’m having trouble writing it back.
Here’s example code:
use framework "Foundation"
use framework "AppKit"
use scripting additions
set dynType to "dyn.12345"
set someData to "My Test Data"
set pasteboard to current application's NSPasteboard's generalPasteboard()
pasteboard's clearContents()
pasteboard's setData:someData forType:dynType
When I run this, I get the following error:
error "Calling -setData:forType: on NSPasteboard or NSPasteboardItem with object of type __NSCFString instead of NSData." number -10000
Any idea on how I can properly define the type?