I need to get the file name of an opened PDF in acrobat. Since script doesn’t know the PDF path it needs to find the title of the active window.
I found this script on Obtain Active window using Python :
from win32gui import GetWindowText, GetForegroundWindow
print GetWindowText(GetForegroundWindow())
It's working but since I'm starting the script as a keyboard shortcut, the active window changes: it switches from acrobat to python. The active window is not anymore the pdf opened in acrobat but the shortcut that launches the script.
So the script print "script.py"
, instead of the "my pdf.pdf-adobe acrobat"
Any idea how to solve this?