robot-js icon indicating copy to clipboard operation
robot-js copied to clipboard

Custom clipboard formats and binary data

Open scottrippey opened this issue 7 years ago • 3 comments

I've been working on a fork of Robot-JS, trying to build support for native clipboard access. This includes the ability to read / write custom data formats and binary data (instead of just Text and Images). I'd like to know if these changes would be a welcome addition to the project, and if so, I'd like to make sure I'm headed in a good direction before continuing work and creating a PR. I'd also like to make sure I'm not duplicating any other potential work. So here's my first question: Should I be modifying the /Native/ code in this repo? Its hard to tell if the Native code is just copied from robot or if it's developed independently?

scottrippey avatar Dec 20 '16 15:12 scottrippey

Hi, I'm sorry for the late response. Native/Addon is the V8-specific code that binds the JavaScript portion of the library to the C++ version of robot. Native/Robot is a clone of robot. Any changes would likely have to be made on the C++ version of robot unless it's node.js specific.

As for reading/writing custom data formats and binary data, a lot of inspiration for the robot clipboard API came from projects like Qt, JUCE and SDL. From what I remember, they didn't really offer that sort of functionality. Although Qt did something with MIME types, it was rather complicated.

Regardless, I would welcome a change like this but I suggest creating some proof of concept code first as well as some possible use cases for testing. It would also have to support Windows and OSX equally. If you have developed something like that, feel free to share the project with me or open a PR so we can discuss it further. Now is especially a good time since I'm starting work on the next release of Robot!

dkrutsko avatar Feb 25 '17 01:02 dkrutsko

Very cool, thanks for the info. I've successfully built the functionality I was looking for! Although I had little C++ or Obj-C experience, I was very pleased with your codebase, and found it pretty easy to add my additions. I successfully implemented getTypes, getData, and setData for both Win and Mac, and it's working beautifully now! Honestly, the hardest part was getting the build process configured correctly. It took some work, but I eventually got it building for Node 6 and even for Electron. So I think that would certainly be a useful contribution, too. Anyway, I definitely want to contribute my changes back to this project, so I'm going to try to get approval to share my work, and I'll follow up later on that. I'd love to know what you have in store for the next Robot release!

scottrippey avatar Feb 27 '17 21:02 scottrippey

Yeah, Node is a bit harder to compile because you have to set up a compiler, node-gyp and more but this document explains the entire process for all platforms.

Sounds good on the changes. Looking forward to seeing them. You can track the upcoming features and release progress on the milestons page. I try to work on it whatever I can.

dkrutsko avatar Feb 28 '17 15:02 dkrutsko