Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import shutil
- import os
- import time
- dropbox = "C:\Dropbox\Public"
- full_file_path = sys.argv[1]
- dropbox_uid = "19243931"
- filename = os.path.basename(full_file_path)
- url = "http://dl.dropbox.com/u/"+dropbox_uid+"/"+ filename
- import ctypes
- #Get required functions, strcpy..
- strcpy = ctypes.cdll.msvcrt.strcpy
- ocb = ctypes.windll.user32.OpenClipboard #Basic Clipboard functions
- ecb = ctypes.windll.user32.EmptyClipboard
- gcd = ctypes.windll.user32.GetClipboardData
- scd = ctypes.windll.user32.SetClipboardData
- ccb = ctypes.windll.user32.CloseClipboard
- ga = ctypes.windll.kernel32.GlobalAlloc # Global Memory allocation
- gl = ctypes.windll.kernel32.GlobalLock # Global Memory Locking
- gul = ctypes.windll.kernel32.GlobalUnlock
- GMEM_DDESHARE = 0x2000
- def Get( ):
- ocb(None) # Open Clip, Default task
- pcontents = gcd(1) # 1 means CF_TEXT.. too lazy to get the token thingy ...
- data = ctypes.c_char_p(pcontents).value
- #gul(pcontents) ?
- ccb()
- return data
- def Paste( data ):
- ocb(None) # Open Clip, Default task
- ecb()
- hCd = ga( GMEM_DDESHARE, len( bytes(data,"ascii") )+1 )
- pchData = gl(hCd)
- strcpy(ctypes.c_char_p(pchData),bytes(data,"ascii"))
- gul(hCd)
- scd(1,hCd)
- ccb()
- Paste(url)
- shutil.copy(full_file_path, dropbox)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement