-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwhatsapp_sender.py
67 lines (61 loc) · 1.59 KB
/
whatsapp_sender.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
import sys
import os
from dateutil import parser
import glob
import pyautogui as p
import subprocess
from time import sleep
try:
name = sys.argv[1]
except:
print('No args passed\nSending last file')
name = '1'
def sender(file):
p.click(759, 1032) # pin icon
sleep(.2)
p.click(751, 963) # camera icon
sleep(.2)
p.typewrite(file) # url paster
sleep(.2)
p.press('enter')
sleep(1)
p.press('enter') # confirm send
sleep(2)
p.click(759, 1032) # pin icon
sleep(.2)
p.click(753, 770) # doc icon
sleep(.2)
p.typewrite(file) # url paster
p.press('enter')
sleep(1)
p.press('enter') # confirm send
def main():
if name.isdigit():
counts = int(name)
files = glob.glob('/mnt/PHOTOS/1Customers/Horoscopes/*.jpg')
files.sort(key=os.path.getmtime, reverse=True)
current_index = 0
while counts > 0:
current_file = files[current_index]
if 'IMG.jpg' in current_file:
current_index += 1
continue
sender(current_file)
print(current_file)
current_index += 1
counts -= 1
sleep(1)
else:
sender('/mnt/PHOTOS/1Customers/Horoscopes/'+name+'.jpg')
def open():
sleep(5)
p.click(451, 205) # input name
sleep(.1)
p.typewrite('Dad')
sleep(.5)
p.click(431,335) # user select
sleep(.5)
if __name__ == '__main__':
subprocess.run(['/usr/bin/brave', '--user-data-dir-name="/home/siva/.config/BraveSoftware/Brave-Browser/Profile 1"', 'web.whatsapp.com'])
open()
main()