Search code examples
python-3.xspeech-recognitionwhatsapppyttsx3

How to open wa.me link directly on Whastapp desktop application, rather than it redirecting to web (on PC)?


I am writing a Python script (3.10.2) which opens certain desktop applications via voice command using the pyttsx3 and speech_recognition modules.

I thought of including Whatsapp into this script as well, and provided the wa.me chat link of one of my whatsapp contacts, which would open after a certain voice command is said.

However, the problem lies when it opens the link, instead of directly opening it on the Whatsapp desktop application (already downloaded from MSStore) it redirects itself to the web and then the prompt asks if to continue on web or to open the desktop application.

I want to make it, directly opening the application, rather than going through the web prompts. Is there a way?

Thanks in advance!


Solution

  • Ok, here. There are two ways one is this:

    import subprocess
    
    subprocess.Popen("C:\\Windows\\System32\\whatsapp.exe")
    

    Another is this:

    import os
    os.system("program_name")