0

I'm using JNativeHook to detect drags and clicks outside a JFrame in my program and it's running perfectly. The thing is I need a way (either using JNativeHook or anything else) to check if a folder is opened in my explorer (Finder for Mac) so that I can move a file to this opened folder. JNativeHook doesn't seem to have the option of detecting on what program or window was the click made.

I expect the output of the code I'm looking for to return the path of open folders in my system explorer so that I can move files to this path.

  • You can get active program's title and app name with **AppleScript**, also the link is [here](https://stackoverflow.com/questions/48713135/applescript-that-reads-active-application-name-title-and-url) You can run AppleScript in Java. – Yunus ER Jul 10 '19 at 08:51

1 Answers1

0

You will not be able to detect if explorer is opened to a particular folder. There are API's to detect things like the window under the cursor and get information like the title, however, if explorer is not displaying the path in the title, it will be very hard to detect without traversing the application components and finding the address bar of the window. See WindowFromPoint and GetWindowTextA for a staring point. It should work fine under JNA and can be combined with the coordinates returned from JNativeHook.

Alex Barker
  • 4,316
  • 4
  • 28
  • 47