-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
72 lines (53 loc) · 1.67 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import pyautogui
import os
import time
from plyer import notification
import keyboard
# For getting desktop path
Desktoppath = os.path.join((os.environ['USERPROFILE']),'Desktop')
# print(Desktoppath)
# For get Screenshot folder path
sspath = os.path.join(Desktoppath,'Screenshot')
# print(sspath)
# For make folder named Screenshot in desktop
def ssfolder():
if os.path.isdir(sspath) == True:
# print("ssfolder exists")
pass
else:
os.mkdir(sspath)
# print("ssfolder created")
# for get datewise folder path
datefoldername = time.strftime("%d-%m-%Y")
datefolderpath = os.path.join(sspath,datefoldername)
# print(datefolderpath)
# for make datewise folder in screenshot folder
def datefolder():
if os.path.isdir(datefolderpath) == True:
# print("datefolder exists")
pass
else:
os.mkdir(datefolderpath)
# print("datefolder created")
# for create screenshot in store in spacif location
def makescreenshot():
# for each image name with time
imagename = time.strftime(r"%H-%M-%S.png")
# print(imagename)
# for each image path
imagepath = os.path.join(datefolderpath,imagename)
# print(imagepath)
pyautogui.screenshot(imagepath)
while True: # making a loop
try: # used try so that if user pressed other than the given key error will not be shown
if keyboard.is_pressed('ctrl+shift+q'): # if key 'ctrl + shift +q' is pressed
break # finishing the loop
elif keyboard.is_pressed('ctrl+space'):
ssfolder()
datefolder()
makescreenshot()
except:
break
# ssfolder()
# datefolder()
# makescreenshot()