NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

from tkinter import *
import tkinter.ttk as combo
from tkinter import messagebox

import webbrowser as web
import pyautogui as pg
import time


def settings(window):
window.configure(background='#ffffff')

window.resizable(False, False)


# Gets the requested values of the height and widht.
windowWidth = window.winfo_reqwidth()
windowHeight = window.winfo_reqheight()
print("Width",windowWidth,"Height",windowHeight)

# Gets both half the screen width/height and window width/height
positionRight = int(window.winfo_screenwidth()/2 - windowWidth/2)
positionDown = int(window.winfo_screenheight()/2 - windowHeight/2)

# Positions the window in the center of the page.
window.geometry("+{}+{}".format(positionRight, positionDown))

print("Width",windowWidth,"Height",windowHeight)


window.title("Whatsapp Web Message Scheduler")
combostyle = combo.Style()

combostyle.theme_create('combostyle', parent='alt',
settings = {'TCombobox':
{'configure':
{'selectbackground': 'white',
'fieldbackground': 'white',
'background': 'white'
}}}
)
# ATTENTION: this applies the new style 'combostyle' to all ttk.Combobox
combostyle.theme_use('combostyle')

def sendNow():
phoneNo = countryCode.get() + number.get()
willSend = quote(message.get("1.0", "end-1c"))

if len(phoneNo) == 0:
messagebox.showwarning(title = "Warning", message = "Please enter a phone number")
return False

if len(phoneNo) < 10:
messagebox.showwarning(title = "Warning", message = "Please enter a valid phone number.")
return False

if len(willSend) == 0:
messagebox.showwarning(title = "Warning", message = "Please enter a message.")
return False

currentMouseX, currentMouseY = pg.position()

web.open('https://web.whatsapp.com/send?phone='+phoneNo+'&text='+willSend)
time.sleep(3)
width, height = pg.size()
pg.click(width/2 , height/2)
time.sleep(3)
pg.press('enter')
messagebox.showinfo(title = "Succesful", message = "Mission Completed.")

def sendAt():
phoneNo = countryCode.get() + number.get()
willSend = message.get("1.0", "end-1c")
time_hour = int(hour.get())
time_minute = int(minute.get())

if time_hour == 0:
time_hour = 24

callsec = (time_hour * 3600) + (time_minute * 60)

curr = time.localtime()
currhr = curr.tm_hour
currmin = curr.tm_min
currsec = curr.tm_sec

if currhr == 0:
currhr = 24

currtotsec = (currhr * 3600) + (currmin * 60) + (currsec)

lefttm = callsec - currtotsec

if lefttm <= 0:
lefttm += 86400

infoText = "Your message will sent at : {}:{}".format(time_hour, time_minute)
messagebox.showinfo(title = "Info", message = infoText)

sleeptm = lefttm
time.sleep(sleeptm)

currentMouseX, currentMouseY = pg.position()

web.open('https://web.whatsapp.com/send?phone='+phoneNo+'&text='+willSend)
time.sleep(3)
width, height = pg.size()
pg.click(width/2 , height/2)
time.sleep(3)
pg.press('enter')
messagebox.showinfo(title = "Succesful", message = "Mission Completed.")



def setHours():
hours = []
i = 0
while i < 25:
if i < 10:
hours.append("0{}".format(i))
else:
hours.append("{}".format(i))
i += 1
return hours

def setMinutes():
hours = []
i = 0
while i < 60:
if i < 10:
hours.append("0{}".format(i))
else:
hours.append("{}".format(i))
i += 1
return hours



window = Tk()

settings(window)

window.grid_rowconfigure(3, weight=1)
window.grid_columnconfigure(3, weight=1)

countryCodeInfoText = Label(window, text="CC / Number", font = ("Arial", 12), bg = 'white')
countryCodeInfoText.grid(column = 0, row = 0, padx = 5, pady = 5)

hourInfoText = Label(window, text="Hour / Minute", font = ("Arial", 12), bg = 'white')
hourInfoText.grid(column = 0, row = 7, padx = 5, pady = 5)

messageInfo = Label(window, text = "Write a Message", font = ("Arial", 12), bg = 'white')
messageInfo.grid(column = 1, row = 2, padx = 5, pady = 5, sticky = "nswe")

countryCode = Entry(window,width = 4)
countryCode.insert(0, "+")
countryCode.grid(column = 1, row = 0, padx = 5, pady = 5)

number = Entry(window,width = 14)
number.grid(column = 2, row = 0, padx = 5, pady = 5)

hour = combo.Combobox(window, state = "readonly", width = 5)
hours = setHours()
hour['values'] = hours
hour.current(0)
hour.grid(column = 1, row = 7, padx = 5, pady = 5)

minute = combo.Combobox(window, state = "readonly", width = 5)
minutes = setMinutes()
minute['values'] = minutes
minute.current(0)
minute.grid(column = 2, row = 7, padx = 5, pady = 5)

message = Text(window, height = 1, width = 50, highlightcolor = 'green')
message.grid(column = 1, row = 3, padx = 5, pady = 5, sticky = "nswe")

# Facebook Blue : #4267B2
# Whatsapp Green : #25D366

btn = Button(window, text="SEND NOW", command = sendNow, bg = "#25D366", fg = 'white')
btn.grid(column = 1, row = 4, padx = 5, pady = 5, sticky = "nswe")


btn = Button(window, text="SEND AT", command = sendAt, bg = "#4267B2", fg = 'white')
btn.grid(column = 1, row = 5, padx = 5, pady = 5, sticky = "nswe")


window.mainloop()
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.