inspecting the Pasteboard: Drop Inspector
Today I thought about a nice and easy way to inspect drag and drop objects or any Pasteboard in general. I ended up creating Drop Inspector, a very simple app that shows you the content of the General Pasteboard if you click on the drop area, or the content of the dragging pasteboard if you drag something on the drag area.
One big problem was that Cocoa (or OS X in general) doesn’t allow you to register a view for any draggin types. The app doesn’t even receive the mouse over event if you didn’t register for a certain type. But to solve this i simply added a text-input field where you can enter the identifier of this pasteboard type and click on “add type”.
Drop Inspector is listing all types that are registered in the pasteboard and if you select one it’ll show you the data of these types in a text-editor. That’s not the most useful thing to have, but better than nothing…copy and paste it into the hex-editor of your choice and see what comes out.
A much better way of processing this data is through FScript. So I added a simple FScript editor to the app, enter some code, hit Cmd-I and inspect the result. As most data on the clipboard is string data, the default is:
NSString alloc initWithData:data encoding:NSUTF8StringEncoding.
I guess it should be pretty useful for anyone who wants to add drag and drop support to an application or who wants to extend it and needs to see what kind of data is available.
The app is released under MIT License and includes the source-code. The disc image can be loaded from: DropInspector.dmg
Karsten
PS: oh, and if there’s any icon artist out there with some freetime, willing to create a better icon for DropInspector, please do! 🙂
March 7th, 2008 at 6:01
Check out Clipboard Viewer (/Developer/Applications/Utilities/Built Examples/). A good interface for the general pasteboard, just OK for the drag pasteboard…but it shows you the string representation of the data as well.
March 7th, 2008 at 7:15
true, but it doesn’t have the nice Fscript interpreter 😉