-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyW-Sender.py
More file actions
89 lines (81 loc) · 3.07 KB
/
Copy pathPyW-Sender.py
File metadata and controls
89 lines (81 loc) · 3.07 KB
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
#Importe Libs
import pywhatkit
import time
import os
import sys
import datetime
import FreeSimpleGUI as sg
sg.theme("DarkGreen1")
if os.path.exists('pywhatkit_dbs.txt'):
os.remove('pywhatkit_dbs.txt')
firstlayout = [
[sg.Text("Nachrichten Sender")],
[sg.Text("Die Vorwahl:"), sg.InputText()],
[sg.Text("Die Nummer:"), sg.InputText()],
[sg.Text("Die Nachricht:"), sg.InputText()],
[sg.Text("Die Ankunftsstunde:"), sg.Spin(values=["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"])], #, key="-Std-")
[sg.Text("Die Ankunftsminute:"), sg.Spin(values=["00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55"])], #, key="-Min-")
[sg.Button("Senden")],
[sg.Text(key="-Anwser-")]
]
layout = [
[sg.Text("Nachrichten Sender")],
[sg.Text("Die Nummer:"), sg.InputText()],
[sg.Text("Die Nachricht:"), sg.InputText()],
[sg.Text("Die Ankunftsstunde:"), sg.Spin(values=["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"])],
[sg.Text("Die Ankunftsminute:"), sg.Spin(values=["00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55"])],
[sg.Button("Senden")],
[sg.Text(key="-Anwser-")]
]
if os.path.exists('Prefix.txt'):
window = sg.Window("PyW-Sender", icon="Icon.png", element_justification='c').Layout(layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
if os.path.exists('pywhatkit_dbs.txt'):
os.remove('pywhatkit_dbs.txt')
break
elif event == "Senden":
window.minimize()
Nummer = values[0]
Nachricht = values[1]
Hr = values[2]
Min = values[3]
with open("Prefix.txt", "r") as o:
Vor = o.read()
o.close()
h = datetime.datetime.now().strftime("%H")
m = datetime.datetime.now().strftime("%M")
Time = ((int(Hr) * 3600) + (int(Min) * 60) - ((int(h) * 3600) + (int(m) * 60)))
sg.popup(f"Die Nachricht wird in {Time} Sekunden gesendet")
pywhatkit.sendwhatmsg(Vor + Nummer, Nachricht, int(Hr), int(Min))
sg.popup("Done!")
break
else:
window = sg.Window("PyW-Sender", icon="Icon.png", element_justification='c').Layout(firstlayout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
if os.path.exists('pywhatkit_dbs.txt'):
os.remove('pywhatkit_dbs.txt')
break
elif event == "Senden":
window.minimize()
Vor = values[0]
Nummer = values[1]
Nachricht = values[2]
Hr = values[3]
Min = values[4]
with open("Prefix.txt", "w") as w:
w.write(Vor + "\n")
w.close()
h = datetime.datetime.now().strftime("%H")
m = datetime.datetime.now().strftime("%M")
Time = ((int(Hr) * 3600) + (int(Min) * 60) - ((int(h) * 3600) + (int(m) * 60)))
sg.popup(f"Die Nachricht wird in {Time} Sekunden gesendet")
pywhatkit.sendwhatmsg(Vor + Nummer, Nachricht, int(Hr), int(Min))
sg.popup("Done!")
break
if os.path.exists('pywhatkit_dbs.txt'):
os.remove('pywhatkit_dbs.txt')
window.close()