Function to check if a folder is open in Windows 7 Explorer

25 views
Skip to first unread message

R. Miranda

unread,
Nov 15, 2016, 2:33:16 AM11/15/16
to wxPython-users
I have a wxPython 3.0.2.0 application that runs excellently under Windows 7. I need to add a function that opens a Windows folder, but only if that Windows folder has not been opened yet (to avoid multiple copies of the same folder).

Hence the question: is there a python facility (native or via a python library) that can tell me if  - in my case - a folder is open in Windows Explorer? 

I know there are specific utilities (e.g. handle.exe) that can do this, but would prefer not to deal with extra executables.




James Scholes

unread,
Nov 15, 2016, 5:31:56 AM11/15/16
to wxpytho...@googlegroups.com
R. Miranda wrote:
> I need to add a function that opens a Windows folder, but only if
> that Windows folder has not been opened yet (to avoid multiple copies
> of the same folder).

On my system at least, if you use os.startfile to open the folder in
Windows Explorer and the folder is already open, the existing window
will be focused rather than a new one being launched. This behaviour
probably depends on a setting somewhere or other, though.
--
James Scholes
http://twitter.com/JamesScholes

R. Miranda

unread,
Nov 15, 2016, 7:11:32 AM11/15/16
to wxPython-users
James, that did the trick, thanks for your reply.
Reply all
Reply to author
Forward
0 new messages