-
Notifications
You must be signed in to change notification settings - Fork 0
/
write.py
executable file
·50 lines (38 loc) · 1.11 KB
/
write.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
#!/usr/bin/env python
import os
from dotenv import load_dotenv as env # I will use my local .env file
import pyautogui
import logging
import argparse
parser = argparse.ArgumentParser() # Parse Args
parser.add_argument("-e", action="store_true")
parser.add_argument("-p", action="store_true")
args = parser.parse_args() # All passes arguments
env() # load my local .env file and then I can use os.getenv("")
def debug(msg):
logging.basicConfig(
format="%(asctime)s %(message)s",
filename="/home/sdsaati/write.py.log",
filemode="w",
level=logging.DEBUG,
)
logging.debug(msg)
def put_mail():
# auto write my email whenever I needed
pyautogui.PAUSE = 1
pyautogui.FAILSAFE = True
pyautogui.keyUp("alt")
pyautogui.write(os.getenv("EMAIL"))
def put_second():
# write this as automation
pyautogui.PAUSE = 1
pyautogui.FAILSAFE = True
pyautogui.keyUp("alt")
pyautogui.write(os.getenv("MC"))
def main():
if args.e: # email will write
put_mail()
elif args.p: # p will write
put_second()
if __name__ == "__main__":
main()