![]() Print(*explorer_fileselection(), sep="\n")Ĭ:\Users\oe\Python\ssa\util\explorer_filer.py ![]() Selected_files = ()įiles.append(selected_files.Item(file).Path)Įxcept: #Ugh, need a better way to handle this one import win32gui, timeįrom win32con import PAGE_READWRITE, MEM_COMMIT, MEM_RESERVE, MEM_RELEASE, PROCESS_ALL_ACCESS, WM_GETTEXTLENGTH, WM_GETTEXTįrom commctrl import LVS_OWNERDATA, LVM_GETITEMCOUNT, LVM_GETNEXTITEM, LVNI_SELECTEDĬlsid = '' #Valid for IE as well! When I started this script on Windows 10, I think it worked, but I don't have 10 anymore so I don't know for sure (I'm using 7 again, so for 7 this works). The other answer was made to work with XP. I think all of this works from Vista (not sure, running 7 here) to 10, but I'm not completely sure. This code is a mix of this answer by James Kent: (corrected by me to work at least under Windows 7) and Olav's answer and the result worked for me - the script detects the files only in the current Windows Explorer window. I don't know if this answer worked for anyone else, but for me it didn't completely so I thought I could improve it and post my solution here. But after coming back to this, I thought on this idea. I know this is a "bit" late to post an answer here, but I had tried Olav's solution some months ago and it didn't work completely: the working directory was the script's working directory, so I had to delete the if condition for it to work, but it selected all the files in all Windows Explorer windows (which I wanted too, so it worked partially for me).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |