octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.37k stars 961 forks source link

Compare to Nut.JS ? #695

Open linonetwo opened 3 years ago

linonetwo commented 3 years ago

Hi, can there be an compare to https://github.com/nut-tree/nut.js in the Readme or somewhere (maybe in this issue)?

I'm trying to choose the correct one for my project, or any other alternatives, thanks!

s1hofmann commented 2 years ago

Hi @linonetwo 👋

I may be the maintainer of nut.js, but let me explain what actually led me to creating nut.js, as this will highlight some of the key differences.

The first an most obvious reason was that Robotjs is unmaintained and does not provide prebuilds for recent node versions. It also requires new builds for every new major version of node.

nut.js initially relied on a fork of robotjs, but keeping up with releases got pretty cumbersome and I rewrote the whole thing using Node-API bindings. This will fully unfold with the upcoming 2.0.0 release of nut.js, making it fully independent of any particular node or Electron version.

The next point might be opinionated, but I think the API provided by nut.js is way easier to deal with compared to robotjs. Once again, since nut.js uses a Node-API rewrite of robotjs internally, these APIs are the same, nut.js provides a nice abstraction on top of it.

Overall, nut.js gained a lot of additional functionality compared to Robotjs.

Searching for images, highlighting screen regions, working with application windows, proper support for scaling on Windows etc.

The upcoming release brings even more to the table, as it will introduce a plug-in system to replace even lowlevel stuff. The provided keyboard typing code does not work for you? Wrap whatever works for you in a provider plug-in and you can use it. Also, with the next release, nut.js will support Apple Silicon chips.

I don’t want to diminish any of the work on robotjs, @octalmage did a great job there! It’s just that its API and previously mentioned issues did not suit my expectations for a modern automation framework.

I hope this post gave you enough insights to choose whichever fits your needs best!

Best regards

Simon

draeder commented 1 year ago

@s1hofmann Can nut properly find the edges of additional displays? For example in the layout below I want to find all of the edge coordinates that do not lead to another monitor.

Screen Shot 2022-12-28 at 5 12 31 AM

I've been struggling with this in two languages now (python, node.js). I'm trying to build a mouse/keyboard sharing app to defeat the lag I keep encountering over wifi with other VKVMs like the Synergy-based Barrier.

linonetwo commented 1 year ago

@draeder Why not open new issue? You are notifying us that are not care about your usage.

linonetwo commented 1 year ago

I keep this issue on, because I hope @octalmage can add the comparison somewhere in the readme.

s1hofmann commented 1 year ago

@draeder No, nut.js does not support multiple monitors yet as I'm lacking both time and resources to tackle this rather complex topic. There's an issue for it (https://github.com/nut-tree/nut.js/issues/165) on the nut.js repo, though, so you might want to switch over to it.

draeder commented 1 year ago

Thanks @s1hofmann -- I'll check in there. I also opened an issue with systeminformation. This certainly is a complex topic.