Automated message
PyAutoGUI is a Python automation library used to click, drag, scroll, move, etc. It can be used to click at an exact position.
PyAutoGUI module ,Python scripts control the mouse and keyboard to automate interactions with other applications. The API is designed to be as simple. PyAutoGUI works on Windows, macOS, and Linux, and runs on Python 2 and 3.
This code is used to create the automated message in WhatsApp, iMessage, telegram and other social media.
Preview :
Requirements: text editor such as Python IDLE. In my case I’m using Pycharm {In mobile you can use Pydroid 3}
Modules: PyautoGUI.
Import the relevant module {pyautogui}. This pyautogui is pre-installed python library that enables the users to create automations and mouse, keyboard controls.
Features:
- Sending keystrokes to applications (for example, to fill out forms).
- Take screenshots, and it is saved as .png or .jpeg extension.
- Locate an application’s window, and move, resize, maximize, minimize, or close it (Windows-only, currently)
- Display message boxes for user interaction while your GUI automation script runs.{ as like cross-site scripting “alert messages”}
- Moving the mouse and clicking or typing in the windows of other applications.
To install pyautogui module: pip install pyautogui
- On windows : py -m pip install pyautogui
- On Mac OS : python3 -m pip install pyautogui
- On linux OS : python3 -m pip install pyautogui
Let’s open the Pycharm and create new project and start our automated message program.
First we importing the relevant module namely pyautogui, time modules.
Creating the one .txt file for the message containing some texts or messages.
hai im srilaki_varma
this is the automated message send to the people in whatsapp,and other messangers
im using this with the help of the python
im using the pyautogui module
in this project we creating spam message also.
Create the main function of python(main.py).
Now we setting the time sleep for 10 seconds.
Creating the variable named text used to read and store the message.txt file which we created before in main.py.
Now make the for loop with some pyautogui functions like typewrite, press.
import time
import pyautogui
time.sleep(8)
text = open("message.txt", 'r')
for each in text:
pyautogui.typewrite(each)
pyautogui.press("enter")
output:
Frequent automated messages:
Let’s we make the code more fun with while loop.
It will send the message frequently until the code is terminated.
import time
import pyautogui
time.sleep(8)
while True:
text = open("message.txt", 'r')
for each in text:
pyautogui.typewrite(each)
pyautogui.press("enter")
output:
Creating the spam message:
Lets make the variable text with user input as “do you want send message yes/no:”
And make another two variables t and n which contains yes and no commands.
If the command yes is given by the user the message is send to the person using pyautogui.
# importing the module
import pyautogui
import time
text=input("DO you want send message yes/no:")
t="yes"
n="no"
#time.sleep(10)
if (text==t!=n):
pyautogui.typewrite(" πTake food π₯ ")
pyautogui.press("enter")
time.sleep(10)
pyautogui.typewrite(" Take medicine ")
pyautogui.press("enter")
time.sleep(10)
pyautogui.typewrite(" Take rest ")
pyautogui.press("enter")
time.sleep(10)
pyautogui.typewrite(" Good night ")
pyautogui.press("enter")
time.sleep(10)
else:
print("unconditional error")

Comments
Post a Comment