This issue is Based on #20
However #20 was closed yet I see several people still have an issue and This is still an issue for me.
My Environment
Chrome Version 97.0.4692.71 (Official Build) (64-bit)
Win 10 V 21H1
2 monitors (Laptop screen plus 1 HDMI)
Line speed 20m/s
PyWhatKit 5.3
Python 3.9
The Code
I had to include flask else the code would not work,
import pywhatkit as wu
import flask
wu.sendwhatmsg_instantly("+27790995412", "Test this now", 15)
What I found:
When code (PyCharm) is on main screen and browser on the other:
PyCharm has focus (naturally)
New tab opens and load WhatsApp (Chrome has focus now)
Message is typed in text area BUT not sent
Seems + is pressed (sent) and then an enter is sent (This leaves an additional new line in the code)
Code ends
When code (PyCharm) AND browser on the other screen :
PyCharm has focus (naturally)
New tab opens and load WhatsApp (Chrome has focus now)
Message is typed in text area BUT not sent
Seems + is pressed (sent) and then an enter is sent
3.1. NOTE the "3rd" window or app was my FileExplorer and a word doc was highlighted
3.2. The result of the alt tab is that the File explorer receives focus and when the enter is pressed then the highlighted file (word doc) is opened...
Code ends
When code (PyCharm) AND browser on the MAIN screen :
PyCharm has focus (naturally)
New tab opens and load WhatsApp (Chrome has focus now)
Message is typed in text area BUT not sent
NOTE now it seems NOT to do an +
3.1. It seems the focus is still in the browser and in the WhatsApp tab...
Code ends
My Fix
I am keeping the Code and Chrome on the main screen.
and had to add a few lines of code to "send" the message
import pywhatkit as wu
import flask
import pyautogui as pg
wu.sendwhatmsg_instantly("+27790995412", "Test this now", 15)
for i in range(10):
pg.press("tab")
pg.press("enter")
This issue is Based on #20 However #20 was closed yet I see several people still have an issue and This is still an issue for me.
My Environment
Chrome Version 97.0.4692.71 (Official Build) (64-bit) Win 10 V 21H1 2 monitors (Laptop screen plus 1 HDMI) Line speed 20m/s
PyWhatKit 5.3 Python 3.9
The Code
I had to include flask else the code would not work,
What I found:
When code (PyCharm) is on main screen and browser on the other:
When code (PyCharm) AND browser on the other screen :
When code (PyCharm) AND browser on the MAIN screen :
My Fix
I am keeping the Code and Chrome on the main screen. and had to add a few lines of code to "send" the message