I was able to get this working in conjunction with TestPlant Support.
- Windows + eggPlant does not have the ability to read console output. You need to dump the output to a file and then read it back.
- First make a handler (or in plain words, function) as follows.
- Modify the path
sdkPath
according to your Windows system.
In this example I want to run adb shell "df | grep data | awk '{print $4}'"
which will basically print out the free space in the /data
folder of my Android Device.
Since my code has quotes, I have to enclose the code within <<>>
.
to adb
set command to <<shell "df | grep data | awk '{print $4}'">>
put "D:\adt-bundle\sdk\platform-tools" into sdkPath
set cmd to " /c " && sdkPath & "\adb.exe" && command && " > C:\adbOutput.txt"
put cmd
shell "C:\Windows\system32\cmd.exe", cmd
end adb
The value of the variable cmd
expands to /c D:\adt-bundle\sdk\platform-tools\adb.exe shell "df | grep data | awk '{print $4}'" > C:\adbOutput.txt
.
Ultimately what gets executed is equivalent to
cmd /c D:\adt-bundle\sdk\platform-tools\adb.exe shell "df | grep data | awk '{print $4}'" > C:\adbOutput.txt
If I want to make the adb
handler accept parameters, I'd add a Params cmd
line to the adb
handler, obviously.