1

How do I get the caret position - whenever prompted - outside the electron app? The functionality would be similar to iohook's keydown event - but along with the keycode, I want the caret position (coordinates).

Is it possible? If so - how? Can something like this be done?

Dhruv Ramani
  • 2,633
  • 2
  • 22
  • 29
  • Outside your electron application? I don't think that's possible without a very specialized application that works with native system APIs. I'm not a native application developer, but AFAIK, applications don't normally have that access, so you will have to jump through a couple hoops if it's even feasible. For example, on mobile something like that is only possible for "accessibility" apps that have unlimited permissions. – Chris Hayes Feb 07 '21 at 05:16
  • @ChrisHayes check out [iohook](https://wilix-team.github.io/iohook/) - which was linked in the question. It is possible to access it. – Dhruv Ramani Feb 07 '21 at 06:13
  • I guess I should've been more specific. That is a pretty neat library that can catch keyboard+mouse inputs at a global level. Text selection behavior though exists inside a particular application, accessing that is basically impossible without special accessibility permissions. The major difference is keyboard+mouse events are broadcasted to the entire system, but anything going on inside an application is private information between the app and the system. Either that app or the system would have to give you access to that as far as I'm aware. – Chris Hayes Feb 07 '21 at 07:02

0 Answers0