Advertisement
Guest User

Untitled

a guest
Apr 9th, 2012
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. import sys
  2. import shutil
  3. import os
  4. import time
  5.  
  6. dropbox = "C:\Dropbox\Public"
  7. full_file_path = sys.argv[1]
  8. dropbox_uid = "19243931"
  9.  
  10.  
  11. filename = os.path.basename(full_file_path)
  12.  
  13. url = "http://dl.dropbox.com/u/"+dropbox_uid+"/"+ filename
  14.  
  15. import ctypes
  16.  
  17. #Get required functions, strcpy..
  18. strcpy = ctypes.cdll.msvcrt.strcpy
  19. ocb = ctypes.windll.user32.OpenClipboard    #Basic Clipboard functions
  20. ecb = ctypes.windll.user32.EmptyClipboard
  21. gcd = ctypes.windll.user32.GetClipboardData
  22. scd = ctypes.windll.user32.SetClipboardData
  23. ccb = ctypes.windll.user32.CloseClipboard
  24. ga = ctypes.windll.kernel32.GlobalAlloc    # Global Memory allocation
  25. gl = ctypes.windll.kernel32.GlobalLock     # Global Memory Locking
  26. gul = ctypes.windll.kernel32.GlobalUnlock
  27. GMEM_DDESHARE = 0x2000
  28.  
  29. def Get( ):
  30.   ocb(None) # Open Clip, Default task
  31.  
  32.   pcontents = gcd(1) # 1 means CF_TEXT.. too lazy to get the token thingy ...
  33.  
  34.   data = ctypes.c_char_p(pcontents).value
  35.  
  36.   #gul(pcontents) ?
  37.   ccb()
  38.  
  39.   return data
  40.  
  41. def Paste( data ):
  42.   ocb(None) # Open Clip, Default task
  43.  
  44.   ecb()
  45.  
  46.   hCd = ga( GMEM_DDESHARE, len( bytes(data,"ascii") )+1 )
  47.  
  48.   pchData = gl(hCd)
  49.  
  50.   strcpy(ctypes.c_char_p(pchData),bytes(data,"ascii"))
  51.  
  52.   gul(hCd)
  53.  
  54.   scd(1,hCd)
  55.  
  56.   ccb()
  57.  
  58. Paste(url)
  59.  
  60.  
  61. shutil.copy(full_file_path, dropbox)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement