Steve-vfp9user
Programmer
Hello all
Haven't posted for a long time and hoping someone can suggest a link or other assistance.
This forum has multiple posts for WhatsAPP messages via VFP but having tried them, none appear to be working, well at least not for me.
I have the WhatsAPP Windows 10 App installed from the Microsoft Store which actually opens when I run the code below and shows the thread of the recipient I am trying to send a message to but the actual message is not being sent.
I asked chatGPT to come up with this but it's not working. No error meesages are shown.
Haven't posted for a long time and hoping someone can suggest a link or other assistance.
This forum has multiple posts for WhatsAPP messages via VFP but having tried them, none appear to be working, well at least not for me.
I have the WhatsAPP Windows 10 App installed from the Microsoft Store which actually opens when I run the code below and shows the thread of the recipient I am trying to send a message to but the actual message is not being sent.
I asked chatGPT to come up with this but it's not working. No error meesages are shown.
Code:
DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
INTEGER hWnd, STRING lpOperation, STRING lpFile, ;
STRING lpParameters, STRING lpDirectory, INTEGER nShowCmd
* Define the recipient phone number (without spaces or symbols)
lcPhoneNumber = "447539677744" && Replace with actual number
* Define the message to send
lcMessage = "Hello, this is an automated message from Visual FoxPro!"
* Open WhatsApp chat
lcWhatsAppURL = "whatsapp://send?phone=" + lcPhoneNumber
ShellExecute(0, "open", lcWhatsAppURL, "", "", 1)
* Wait for WhatsApp to open
SLEEP(6000) && Adjust delay if needed
* Type the message using NirCmd
lcNirCmdPath = "C:\nircmd\nircmd.exe" && Adjust path if needed
* Simulate typing the message
lcCmd = '"' + lcNirCmdPath + '" sendkeypress "' + lcMessage + '"'
RUN /N &lcCmd
* Simulate pressing "Enter" to send the message
RUN /N C:\nircmd\nircmd.exe sendkeypress 0x0D