HI,
I need to send a file through whatsapp. I used below method. but a small doubt.
int li_connect
ole_wsh = Create OleObject
li_connect = ole_wsh.ConnectToNewObject("WScript.Shell") //
ole_wsh.Run(whatsapp exe path here )
ole_wsh.appActivate("Whatsapp")
sleep (2)
ole_wsh.SendKeys("+{TAB}")
ole_wsh.SendKeys("{ENTER}")
ole_wsh.SendKeys("{DOWN}")
ole_wsh.SendKeys("{DOWN}")
ole_wsh.SendKeys("{DOWN}")
ole_wsh.SendKeys("{DOWN}")
ole_wsh.SendKeys("{ENTER}") // now it is reached file attachment dialogbox.
In this box I need to paste my file in the file name area without use manual selection.
Have any chance ?.
Sendkey(filename) could also work
Maybe you have to wait (sleep) a second after each Sendkey? If this is to long you may try a small loop that evaluets cpu() function. Or use the timing objects - it allows to specify fractions of seconds.
Sendkey(filename) could also work = I think will work the ole object sleep method.
Maybe you have to wait (sleep) a second after each Sendkey? = Yes i did. no use
If this is to long you may try a small loop that evaluets cpu() function. = I give a loop 10 million nos.. cpu is consuming it's time. but no use
ole_wsh.Run("notepad.exe")
Sleep(1)
ole_wsh.SendKeys("^o") // CTRL+O (File->Open)
ole_wsh.SendKeys("test.txt") // file must exists
ole_wsh.SendKeys("{ENTER}")