Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- import time
- from selenium import webdriver
- from selenium.webdriver.common.action_chains import ActionChains
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.chrome.options import Options as ChromeOptions
- from selenium.webdriver.firefox.options import Options as FirefoxOptions
- def send_data(driver_type):
- target_numbers = entry1.get("1.0", "end-1c").strip().split('\n')
- message = message_label1.get("1.0", "end-1c").strip()
- if driver_type == 'chrome':
- options = ChromeOptions()
- options.headless = False # Set to True if you want it to run in the background (headless)
- driver = webdriver.Chrome(options=options)
- elif driver_type == 'firefox':
- options = FirefoxOptions()
- options.headless = False # Set to True if you want it to run in the background (headless)
- driver = webdriver.Firefox(options=options)
- login_time = 60
- new_msg_time = 15
- send_msg_time = 15
- link = 'https://web.whatsapp.com'
- driver.get(link)
- time.sleep(login_time)
- for target_number in target_numbers:
- cleaned_number = target_number.strip()
- if cleaned_number and message:
- if not cleaned_number.startswith('+'):
- cleaned_number = '+' + cleaned_number
- cleaned_number = cleaned_number.replace(" ", "").replace("-", "").replace("(", "").replace(")", "")
- whatsapp_link = f"https://web.whatsapp.com/send/?phone={cleaned_number}&text={message}"
- driver.get(whatsapp_link)
- time.sleep(new_msg_time)
- actions = ActionChains(driver)
- actions.send_keys(Keys.ENTER)
- actions.perform()
- time.sleep(send_msg_time)
- driver.quit()
- def marque_text():
- text = mlabel.cget("text")
- text = text[1:] + text[0]
- mlabel.config(text=text)
- app.after(1000, marque_text)
- app = tk.Tk()
- app.title("SENDER")
- app.geometry("800x600")
- app.configure(bg="gray")
- app = tk.Frame(app, bg="#47926e")
- app.pack(fill=tk.BOTH, expand=True)
- mframe = tk.Frame(app, bg="#01e675")
- mframe.pack(fill=tk.BOTH)
- mlabel = tk.Label(mframe, text="DAPATBELAJAR.COM - ", font=("MV Boli", 20, "bold"), bg="#01e675", underline=-1)
- mlabel.pack(side=tk.TOP)
- marque_text()
- frame1 = tk.Frame(app, bg="#47926e")
- frame1.pack(fill=tk.X, pady=20)
- label1 = tk.Label(frame1, width=10, text="Target\nNumbers", font=("Copperplate", 15, "bold"), bg="#25d366", fg="black")
- label1.pack(side=tk.LEFT, padx=5)
- entry1 = tk.Text(frame1, height=4, width=40, font=("Helvetica", 15, "bold"))
- entry1.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=20)
- frame1 = tk.Frame(app, bg="#47926e")
- frame1.pack(fill=tk.X, pady=20)
- message_label = tk.Label(frame1, width=10, text="Your\nMessage", font=("Copperplate", 15, "bold"), bg="#25d366", fg="black")
- message_label.pack(side=tk.LEFT, padx=5)
- message_label1 = tk.Text(frame1, height=4, width=40, font=("Helvetica", 15, "bold"))
- message_label1.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=20)
- button_frame = tk.Frame(app, bg="#47926e")
- button_frame.pack(fill=tk.X, pady=20)
- # Send Button
- chrome_button = tk.Button(app, text="SEND using Chrome", font=("Copperplate", 25, "bold"), bg="#01e675", fg="black", command=lambda: send_data('chrome'))
- chrome_button.pack(side=tk.BOTTOM, fill=tk.BOTH)
- firefox_button = tk.Button(app, text="SEND using Firefox", font=("Copperplate", 25, "bold"), bg="orange", fg="black", command=lambda: send_data('firefox'))
- firefox_button.pack(side=tk.BOTTOM, fill=tk.BOTH)
- app.mainloop()
Advertisement
Advertisement