From: Mark H. <di...@ma...> - 2006-01-19 02:06:52
|
On Jan 18, 2006, at 4:18 PM, Brian Marick wrote: > I want to put arbitrary ASCII strings onto the clipboard (including > NULs, control chars, etc.). I could do this: > > [...] > > I'd rather go through a lower-level API than through applescript, > but I'm ignorant enough of OSA and other topics specific to the Mac > that I can't find what that would look like. > > Can anyone help? Assuming that you are wanting to use the rubycocoa framework for this, you should check out the NSPasteboard class: http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/Classes/NSPasteboard.html Code will look something like this: pb = OSX::NSPasteboard.generalPasteboard pb.setString str, :forType, "NSStringPboardType" Note, I have not tested this code, and it's been a while since I worked with the pasteboard in rubycocoa. This is just to get you started :) cheers, Mark |