How can i connect matlab with whatsapp?

17 visualizzazioni (ultimi 30 giorni)
Zaid
Zaid il 14 Ago 2014
Commentato: Walter Roberson il 12 Ott 2023
I am doing a project of face detection using image proceesing. Now i want to send the detected image to my whatsapp number. How can i connect matlab with whatsapp? Thank you in Advance.
  1 Commento
Mudassir shakeel
Mudassir shakeel il 11 Feb 2023
There is no direct connection between MATLAB and WhatsApp. However, you can use MATLAB to control a computer that runs WhatsApp, for example, by using MATLAB's system command to send messages through an automated script.
Here's an example of how you can use MATLAB to send messages through the WhatsApp Web interface using Google Chrome:
  1. Open Google Chrome and log into WhatsApp Web.
  2. Copy the following MATLAB code into the MATLAB Command Window:
rustCopy code
% Change the path to the location of the Chrome application on your system chrome_path = 'open -a "Google Chrome"'; % Open WhatsApp Web in Chrome system([chrome_path ' https://web.whatsapp.com/']);% Wait for the browser to load pause(10); % Send a message system('osascript send_whatsapp_message.scpt "Your Contact Name" "Your Message"');
  1. Create a new file in a text editor and save it as send_whatsapp_message.scpt (ensure the file extension is .scpt) with the following AppleScript code:
vbnetCopy code
on run argv tell application "Google Chrome" activate set theName to item 1 of argv as string set theMessage to item 2 of argv as string repeat until (do JavaScript "document.readyState === 'complete'") end repeat do JavaScript "var inputs = document.getElementsByClassName('_3uMse'); for (var i = 0; i < inputs.length; i++) { if (inputs[i].title === '" & theName & "') { inputs[i].click(); } }" in tabs on top whose URL contains "web.whatsapp.com" delay 1 repeat until (do JavaScript "document.getElementsByClassName('_13mgZ')[0].innerHTML").toString().contains("message") end repeat do JavaScript "document.getElementsByClassName('_2S1VP copyable-text selectable-text')[0].innerHTML='" & theMessage & "';" in tabs on top whose URL contains "web.whatsapp.com" do JavaScript "document.getElementsByClassName('_35EW6')[0].click();" in tabs on top whose URL contains "web.whatsapp.com" end tell end run
This code opens WhatsApp Web in Google Chrome, waits for the page to load, and then sends a message to the specified contact. The contact name must match the name that appears in WhatsApp Web exactly.
Note that this code is provided as an example and may not work for all configurations and systems. Additionally, automated scripts like this may not comply with WhatsApp's terms of service, so use at your own risk.

Accedi per commentare.

Risposte (2)

Alaa
Alaa il 12 Mar 2018
I got the same problem hahaha لكن انت سالت سنة 2014 الان 2018

GUL BAHAR
GUL BAHAR il 12 Ott 2023

Halley Method with derivatives stability code required

  1 Commento
Walter Roberson
Walter Roberson il 12 Ott 2023
I do not understand how using that method will allow @Zaid to connect their code to Whatsapp ??

Accedi per commentare.

Categorie

Scopri di più su Agriculture in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by