Ankit404butfound / PyWhatKit

Send WhatsApp message at certain time and many other things.
MIT License
1.34k stars 295 forks source link

using existing opened WhatsApp web tab #36

Closed fredy1221 closed 3 years ago

fredy1221 commented 3 years ago

I'm always frustrated when using the "sendwhatmsg" function in a loop, it opens a new tab every time.

Can we have it use the existing tab?

NB: I'm using pg.press("enter") to send the message, otherwise, it just copy-pastes in the text field.

Ankit404butfound commented 3 years ago

Hi, I wanted this library to be safe, adding that feature would allow user to spam others and which ultimately affect the library because WhatsApp doesn't allow any spamming activity, someone might report this library and I might end up losing it.

fredy1221 commented 3 years ago

I just wanted to do an app that will send PCR results of a lab to its clients, no spamming just charity work, because they're doing it manually

aaryanrr commented 3 years ago

@Ankit404butfound is right. Doing that could be useful but it has a downside too. But i think there must be way that closes the previously opened tab if a new sendwhatmsg() function call is given or something like this.

jeemitsha commented 3 years ago

I just wanted to do an app that will send PCR results of a lab to its clients, no spamming just charity work, because they're doing it manually

Did you find any other way to do so?

fredy1221 commented 3 years ago

Nop, I didn't really look into it since then.

perfectwavestocks commented 3 years ago

Sends WhatsApp message to group via Chrome on windows 10

This works only if you go to windows mouse settings and click pointer goes to popups automatically

Otherwise, you must add a move mouse xy command in pyautogui

import pyautogui as pg import webbrowser as web import time

GROUP = 'yougrouphere' message = yourmessagehere'

def WhatsApp(GROUP, message): web.open('https://web.whatsapp.com/accept?code=' + GROUP) time.sleep(10) width, height = pg.size() pg.click(width / 2, height / 2) pg.typewrite(message + "\n") time.sleep(3) pg.hotkey('ctrl', 'w') time.sleep(3) pg.press('enter')

WhatsApp(GROUP, message)

w3labz commented 1 year ago

I think while we are adding time delay in sending messages (and can be set to min 3 seconds), it can be implemented. It would make this library more efficient.