You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
print("Input is not a number.\nSet for 5 as default.")
58
+
return5
59
+
defcheck_user_input2(input):
60
+
try:
61
+
if(str(input) =='y'):
62
+
returnTrue
63
+
elif(str(input) =='yes'):
64
+
returnTrue
65
+
else:
66
+
returnFalse
67
+
exceptValueError:
68
+
print("Input is not a Boolean.\nSet for true as default.")
69
+
returnTrue
70
+
defoption_1(num, text, timeout, PressEnter):
71
+
importtime
72
+
print('Starting after 5 seconds.\nHold (esc) to cancel!')
73
+
ifkeyboard.is_pressed("esc"):
74
+
i=num
75
+
print("ended.")
76
+
time.sleep(5)
77
+
78
+
i=0
79
+
whilei!=num:
80
+
ifkeyboard.is_pressed("esc"):
81
+
i=num
82
+
print("ended.")
83
+
break
84
+
i=i+1
85
+
pg.press('Enter')
86
+
pg.write(str(text))
87
+
pg.press('Enter')
88
+
time.sleep(timeout)
89
+
print(str(i) +' Done')
90
+
defoption_2(timeout, texts):
91
+
importtime
92
+
print('Starting after 5 seconds.\nHold (esc) to cancel!')
93
+
time.sleep(5)
94
+
95
+
fortextintexts:
96
+
ifkeyboard.is_pressed("esc"):
97
+
print("ended.")
98
+
break
99
+
pg.write(str(text))
100
+
pg.press('Enter')
101
+
time.sleep(timeout)
102
+
print(str(text) +' Done!')
103
+
104
+
try:
105
+
options=input("\nHello {UserName},\nOptions:\n[1] Add one sentence that will be auto send\n[2] Add different sentence that will be auto send\nType the option number to start.\n".format(UserName=os.environ["username"]))
106
+
exceptEOFError:
107
+
option=5
108
+
print('Input is EOF exception, please enter something and run me again')
109
+
exit()
110
+
exceptKeyboardInterrupt:
111
+
option=5
112
+
print('You have pressed ctrl-c button.')
113
+
exit()
114
+
115
+
options=check_user_input(options)
116
+
117
+
ifoptions==1:
118
+
Num=input("How many times do you want to send the text?\n")
119
+
Num=check_user_input(Num)
120
+
text=input("Please type the text to send.\n")
121
+
Timeout=input("Please type the time in seconds between every text. (0 for no timeout)\n")
122
+
Timeout=check_user_input(Timeout)
123
+
PressEnter=input("Do you want to use Enter(y/n)?(This option will let the code press enter before and after writing a text!)\n")
124
+
check_user_input2(PressEnter)
125
+
option_1(Num, text, Timeout, PressEnter)
126
+
elifoptions==2:
127
+
Num=input("How much texts do you want to send?\n")
128
+
Num=check_user_input(Num)
129
+
Timeout=input("Please type the time in seconds between every text. (0 for no timeout)\n")
130
+
Timeout=check_user_input(Timeout)
131
+
Texts= []
132
+
i=0
133
+
whilelen(Texts) !=Num:
134
+
i=i+1
135
+
text=input("Type text number ({i}):\n".format(i=i))
136
+
Texts.append(text)
137
+
option_2(Timeout, Texts)
138
+
else:
139
+
print("Unknown input please try again later!")
140
+
141
+
pg.alert(text='The program ended', title='Done', button='Ok')
0 commit comments