Hi,
I made the a script to manipulate files copied into the clipboard from
explorer.
To know if the file was cut or copied it seems need to get information about
the DropEffect - is there a way to do this from win32clipboard ?
S++
[pcp.py]
import os
import sys
import win32api
from win32con import CF_HDROP
from win32clipboard import IsClipboardFormatAvailable, OpenClipboard,
GetClipboardData, CloseClipboard
def main():
targetdir = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else
os.getcwd())
## Note - Need DropEffect to work out if it's copy or cut
OpenClipboard()
if (IsClipboardFormatAvailable(CF_HDROP)):
files = GetClipboardData(CF_HDROP)
else:
files = []
CloseClipboard()
if os.path.abspath(os.path.commonprefix(files)) == targetdir:
print 'Files already in folder [' + targetdir + ']'
## TODO - Check for overwriting
for file in files:
win32api.MoveFile(file, os.path.join(targetdir, os.path.basename(file)))
if __name__ == "__main__":
main()
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32