http://win32com.goermezer.de/content/blogsection/7/284/
一个网站,有各种Windows 下使用 Python 的脚本示例,很不错,有待继续挖掘。
举一个例子:
https://win32com.goermezer.de/content/view/287/285/
import win32com.client
# look in the makepy output for IE for the 'CLSIDToClassMap'
# dictionary, and find the entry for 'ShellWindows'
clsid='{9BA05972-F6A8-11CF-A442-00A0C90A8F39}'
ShellWindows=win32com.client.Dispatch(clsid) # a busy state can be detected:
# while ShellWindows[0].Busy == False:
# go in for-loop here for i in range(ShellWindows.Count):
print ShellWindows[i].LocationURL
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!
这段代码获取当前打开Windows Explorer窗口的名字,以及选中的文件,是不是有种黑科技的感觉呀!