Code: Select all
cmd= C:/Android/platform-tools/adb.exe connect 127.0.0.1:7544
ComOBJ := ComObjCreate("WScript.Shell").Exec(cmd)
Response := ComOBJ.StdOut.ReadAll()
MsgBox %Response%
But when i run the adb in shell:
Code: Select all
cmd= C:/Android/platform-tools/adb.exe -s 127.0.0.1:7544 shell
ComOBJ := ComObjCreate("WScript.Shell").Exec(cmd)
ComOBJ.StdIn.WriteLine("sendevent /dev/input/event0 1 67 1 sendevent /dev/input/event0 0 0 0")
Response := ComOBJ.StdOut.ReadAll()
MsgBox %Response%
It stuck in the StdOut.ReadAll() line forever, however, the command in StdIn.WriteLine is sent correctly.
The StdOut isnt a must, i added it just to try to 'force' the code await the command in WriteLine be executed/finished.
My goal is to keep just one adb running and continuously sent command to it:
Code: Select all
static COMOBJ
; Using shell here to avoid creating a new adb.exe instance for each command, and keep just the same one running.
if (COMOBJ = "") {
cmd= C:/Android/platform-tools/adb.exe -s 127.0.0.1:7544 shell
ComOBJ := ComObjCreate("WScript.Shell").Exec(cmd)
}
ComOBJ.StdIn.WriteLine("sendevent /dev/input/event0 1 67 1 && sendevent /dev/input/event0 0 0 0")
Response := ComOBJ.StdOut.ReadAll() ; Currently code stuck in this line
If the code did not wait till the command sent on StdIn.WriteLine be executed/finished, it became completely async.
For example in a loop it sends new commands while the adb did not finished the previous one yet.
Im trying to avoid creating a new process for each command sent, would like to ask if someone know how to wait for a command sent by StdIn.WriteLine finish.