-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWhatsapp.py
124 lines (94 loc) · 3.4 KB
/
Whatsapp.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import pyautogui
import time
from Body.speak import speak
from Body.listen import micExecution
from Features.Open import openExe
def maximize_window():
# Check if the window is maximized
if not pyautogui.getWindowsWithTitle("WhatsApp")[0].isMaximized:
pyautogui.hotkey('win', 'up')
def send_whatsapp_message(contact_name):
# Open the WhatsApp application
speak("Initializing The Whatsapp Software.")
# whatsapp_path = "whatsapp" # Replace with the actual file path if needed
openExe("open whatsapp")
# Maximize the WhatsApp window
maximize_window()
x = 239 # Replace with the x-coordinate of the location
y = 145 # Replace with the y-coordinate of the location
pyautogui.moveTo(x, y)
pyautogui.click()
time.sleep(2)
pyautogui.write(contact_name)
while True:
speak(f"Please confirm..do you want to send message to this first contact which appeared?")
input=micExecution()
input.lower()
if ("yes") in input or ("correct") in input :
# Prepare to send a message
speak(f"Preparing To Send a Message To {contact_name}, please do not touch")
break
elif (("no") in input) or (("deny") in input) or (("change") in input) or (("no one") in input):
speak("ok, canceling your request")
return True
else:
speak("canceling your request")
return True
time.sleep(2)
# Move the cursor to the specified location and click the mouse after a delay
x = 218 # Replace with the x-coordinate of the location
y = 226 # Replace with the y-coordinate of the location
pyautogui.moveTo(x, y)
time.sleep(2) # Wait for 2 seconds
pyautogui.click()
# send_whatsapp_message(contact_name)
time.sleep(2)
# Ask for the message to send
speak("What's The Message By The Way?")
message = micExecution()
pyautogui.write(message)
# Send the message
time.sleep(5)
pyautogui.press('enter')
speak(f"sent ,{message} to ,{contact_name} sucessfully!")
# if __name__ == '__main__':
# send_whatsapp_message("rishika psit")
# from time import sleep
# from Body.speak import speak
# from Body.listen import micExecution
# from Features.Open import openExe
# import pyautogui
# import time
# speak("Initializing The Whatsapp Software.")
# whatsapp_path = "whatsapp"
# # Open the WhatsApp application
# pyautogui.press('win')
# time.sleep(1)
# pyautogui.write(whatsapp_path)
# pyautogui.press('enter')
# time.sleep(8)
# pyautogui.hotkey('win', 'up')
# def newLine():
# pyautogui.keyDown('shift')
# pyautogui.press('enter')
# pyautogui.keyUp('shift')
# def WhatsappSender(Name):
# speak(f"Preparing To Send a Message To {Name}")
# pyautogui.write(Name)
# time.sleep(2)
# # Move the cursor to the specified location and click the mouse after a delay
# x = 218 # Replace with the x-coordinate of the location
# y = 226 # Replace with the y-coordinate of the location
# pyautogui.moveTo(x, y)
# time.sleep(2) # Wait for 2 seconds
# pyautogui.click()
# time.sleep(2)
# speak("What's The Message By The Way?")
# message = micExecution()
# if "new line" in message:
# message=message.replace("new line",newLine())
# time.sleep(2)
# pyautogui.write(message)
# sleep(10)
# pyautogui.press('enter')
# WhatsappSender("")