Find selected files in Windows Explorer
I searched a long time for this and also Google could not give me an answer to the following question. How can I detect the selected files in a Windows Explorer window? I found following by trial and error...
# look in the makepy output for IE for the 'CLSIDToClassMap'
# dictionary, and find the entry for 'ShellWindows'
# a busy state can be detected:
# while ShellWindows.Busy == False:
# go in for-loop here
for i in range(ShellWindows.Count):
for j in range(ShellWindows[i].Document.SelectedItems().Count):
print ' ', ShellWindows[i].Document.SelectedItems().Item(j).Path
# Be careful: Internet Explorer uses also the same CLSID. You should implement a detection!
Last Updated ( Thursday, 11 October 2012 )