'auto closing of tabs after sending auto message using pywhatkit
I want to send auto message using pywhatkit. It is done by this code :
import pywhatkit
pywhatkit.sendwhatmsg("+92xxxxxxxxxx", "Hello ", 22, 28)
print("Successfully Sent!")
I have followed this link : https://www.geeksforgeeks.org/introduction-to-pywhatkit-module/
I just want to ask is there any way to auto-close the tab after sending an auto message? Thanks.
Solution 1:[1]
If you just want to close the google chrome tab, you can simulate pressing Ctrl+W to close it.
you can use keyboard library - pip install keyboard in cmd, then:
import keyboard
keyboard.press_and_release('ctrl+w')
Or you can use `win32`, `pyautogui` or any other library that let's you do it
Solution 2:[2]
sendwhatmsg has another parameter that is tab_close
import pywhatkit
pywhatkit.sendwhatmsg("+92xxxxxxxxxx", "Hello ", 22, 28,tap_close=True)
print("Successfully Sent!")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ???? ????? |
| Solution 2 | BGOPC |
