-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text Expansion #55
Comments
@Thr1ve I haven't seen a node module, but there is libuiohook , which could probably be wrapped with nan (or something), similar to how robotjs itself is designed. |
+1. Built-in text expansion capabilities similar to AutoHotkey would be a massive benefit. |
I generally use nw.js for hotkeys but as you mentioned its lacking. I'm hoping they improve that because I don't think I want to include hotkey support in RobotJS. If I do work on it, it will be a separate module. I think I'm going to do the same for window management. |
@Thr1ve but RobotJS can get the mouse position currently. |
@fohara thanks for the link! I'll try this library and if it works well, I'll turn it into a node module. It would be very easy. |
@octalmage excellent. I was able to compile and run the |
Awesome! Can't wait to try it out. |
@octalmage Completely agree on the separate module thing; sorry if I implied otherwise! In my mind, there would be a really simple, small, and separate module that would solely listen for any keyboard / mouse events and then emit them as a events / streams / observables / whatever. @fohara Thanks! Can't say I know how to make that work, but it looks like a good time to learn! I've been dreaming of a javascript version of AutoHotkey for so long... major props to @octalmage for what he's done so far 👍 |
Gotcha! I for sure will to try to replace each AHK feature with Node.js modules. If libuiohook works out we'll have a great start for key listening. I'll keep y'all updated! |
@fohara did you encounter this error?
I tried adding it to the list of allowed accessibility apps, but that isn't helping. |
@octalmage ah yes, I did encounter that accessibility error. My short term solution was to add iTerm (or any terminal app) to the allowed list. There is probably a more intuitive way of granting permission for this, but I haven't looked into it yet. |
Ah gotcha. This system is so silly. I had to remove and re-add iterm2. |
@octalmage yeah, there must be a programmatic way to handle this. I remember seeing this before, I think with Sikuli perhaps. There was some flag that prompted permission for accessibility, I'll see if I can find it. |
This tool does it, we can look at the code: https://github.com/jacobsalmela/tccutil But yeah, libuiohook is so perfect. Just need to create an EventEmitter in V8 and we'll be good to go. Looking into this now. |
It looks like emitting events isn't very straight forward but I figured it out. Woohoo! |
@octalmage nice! Looking forward to seeing how the event emitting works for this. |
@octalmage good news on the progress! Regarding the copyright notice, you should be able to suppress it by building the lib with the |
@fohara oh duh, thanks! |
I ran into a block with the c++ EventEmitter. I'm going to rewrite the library with a getKeyState type function. Then I'll figure out the events. |
Any updates on this @octalmage? |
This isn't a priority at the moment, I wouldn't expect it anytime soon. Sorry! |
Looking for a replacement for AutoHotkey, and this is saddening... : (
(Actually, I might just try using #3 to begin with; depends mostly on whether I can find some easy C# code to capture global hotkeys and send them back to nodejs.) Anyway, I'll post back here with my results! (Since this is a pretty significant feature for an automation system) P.S. I realize the approaches above (#1 and #2 anyway) would be Windows-only solutions, so would probably not be wanted as a part/listed-dependency for this project. And that you already have something of a solution using nw.js. But I figured it'd be helpful to at least provide one path of adding hotkeys for other Windows users browsing these threads and not seeing a way explained yet. (I looked briefly at the nw.js project, and didn't see the way you captured hotkeys using it) |
Check out: https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md https://github.com/nwjs/nw.js/wiki/shortcut I use both of these in different apps and they work great for my purpose! |
Hello guys. I just implement libuiohook for node.js. PS. It is cross platform module already tested in Mac and Ubuntu. Should good work in windows and other systems, what supported from libuiohook |
Thanks for making the iohook library WilixLead! Unfortunately, I'm getting an error trying to use it: wilix-team/iohook#16 |
I also tried this very similar package: https://github.com/ayoubserti/node-iohook But it also had an error, while installing. In that case, it's because I didn't have the Visual C++ Build Tools installed. I didn't feel like restarting, and installing the build tools, to try the module out. (at least while other options existed) Which brings me to my third attempt: https://github.com/tomzx/gkm This one finally works! However, it's not preferred, since it uses Java; but for Windows users, it's probably the easiest option atm. (at least, if you can't get the iohook or node-iohook libraries working) |
It would be nice to have a Wiki page listing various libraries that work well with robotjs, for achieving various automation functions. If it's okay with @octalmage, I've gone ahead and created the page here: https://github.com/octalmage/robotjs/wiki/Plugins-(or-compatible-modules) I plan to create some modules myself later, as I'd like to eventually replace AutoHotkey entirely. (AutoHotkey is nice, but it's scripting language is terrible) |
Venryx, This is also a goal of mine. Love what AHK can do, but hate AHK's language. Plus version 2 has been in development for 6+ years. And even if/when that is released, it does not really fix the language issues, but mostly remove the horrible Command syntax in favor of function() syntax. I have wanted to use JS for years to replace my product which is written in AHK. I plan to use NodeJS, TypeScript, Electron and Aurelia, but since I have a full-time job this conversion goes very slowly. I would really enjoying partnering with anyone here on replacing AHK with a cross-platform equivalent. If interested, please contact me directly at [email protected]. |
Hi mviens. I have the same goal, however I've come to believe it's best to build such a system incrementally, based on the foundation here in robotjs. This is because robotjs already has a userbase, and the language/build-process is good, so we can just build up modules around it. For example, I plan to make a module which creates a system-icon at the bottom-right of screen, from which the user can start, stop, or edit a given script file. I plan to make another which adds the ability to query, move, and otherwise control various windows. So for example, an easy way to check the title of the active window, minimize it, etc. We could build a new system from the ground up, but because the NodeJS module system is so flexible (and because gaining traction for a new software system is so hard), I think it's best to just build on this project here (robotjs) and transform it into the full-fledged software we want. By the way, node-ffi is very convenient for hooking into native dll functions. You can do so entirely in JS land! (Even callbacks; I've used it to implement a full-fledged JS keyboard hook, which I now use everyday for global hotkeys. An old capture: https://github.com/Venryx/vdm-window-manager/blob/333f7d1284fbfbea92e4903b4a5a50ebbab685ea/Source/Input/HotkeyManager.ts) |
What does this project (https://github.com/octalmage/robotjs) plan on doing differently than the already built/working project (https://github.com/robot/robot-js)? It seems like the other project has not been updated in a while, does appears to be well thought out and capable. |
Use RobotJS to troubleshoot Electron's GlobalShortcut. So a solution to use as a Global Shortcut! :) |
This issue has been closed because it has been inactive for > 180 days. |
For anyone looking for AutoHotkey-like expansion, I've found Espanso to be a good replacement. |
any updates? |
Would there be any way to do text expansion with robotjs like you can with AutoHotkey?
I was able to get robotjs working with electron so I could listen for global keypresses, but electron (and nw.js) only seems to be able to listen for key combinations, not key sequences.
It would be amazing if we could simply turn any key-presses / mouse-movements into events and/or observables so we could deal with them purely in node-land ( and perhaps use something fancy like http://reactivex.io/ so we could just map/filter/etc the keypresses )
Robotjs is/will be great for sending keyboard commands etc., but I think we'd need a reliable way to listen for these events globally to come close to AutoHotkey. Is there perhaps a node module I haven't found that strictly listens for keypresses / mouse movements globally and outputs them as events ? Surely someone must have written something like this already.
The text was updated successfully, but these errors were encountered: