(Active - the file whose window is in the foreground.)
I am working on a problem which is to extract the text in the current active pdf (.pdf), word (.doc, .docx), or notepad (.txt) file in real time. I have tried JNA, and got the active file name (e.g., a.pdf) and exe name, but not the file path (e.g., C:/Desktop/.../a.pdf.) I need the full file path here, because I can read the corresponding file and extract the text in it once I know its path. (I do not need the exe path, e.g., C:/Program Files/adobe.exe.)
I have checked the doc of JNA, but not found a method which can provide the path of current active file (not a Java application).
Alternatively, I think maybe some package can provide the full path of the current file/icon in focus (e.g., I click a.pdf before I open it and my mouse will focus on a.pdf.) I tried JNI, but still not found such a method.
Could you please provide some suggestions about how to get the path of the current active file (not a Java application) using Java or how to get the path of the current file/icon in mouse focus?
Thanks a lot!