Skip to content
uses the Android adb tool to send input. StdIn will be massaged to go trhu all the hops adb uses unchanged. Require python, but after that, it's as cross-platform as it goes, while using adb directly, you will have problems like not being able to send spaces in windows.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Aug 28, 2013
AdbPaste.py Comments Feb 14, 2017
LICENSE move from gpl3 to apache2 Sep 13, 2013
Makefile check index range Jun 25, 2016
README.md Arguments no longer need to be in order. Implemented --notab argument… Sep 21, 2016
screenshot1.png

README.md

AdbPaste

uses the Android adb tool to send input. StdIn will be massaged to go trhu all the hops adb uses unchanged. Require python, but after that, it's as cross-platform as it goes, while using adb directly, you will have problems like not being able to send spaces in windows.

screenshot1

Usage

--fast Ignores the workaround of breaking up the longer strings into small batches. Works fine for simple inputs. Will fail if used on emulator with fields that do network lookup.

--notab Changes tabs into single spaces

-s Serial number of the device adb should use. Analogous to -s flag of adb (use adb devices to see a list). Only needed if more than one device are available.

--file Next argument must be a filename. Content will be sent.

If --file is not used, all the next arguments will be sent

the problem

Can not use spaces in win32. Even with escaping.

C:\CODE\AdbPaste>adb shell input text "simple test"
Error: Invalid arguments for command: text
usage: input ...
       input text <string>
       input keyevent <key code number or name>
       input [touchscreen|touchpad|touchnavigation] tap <x> <y>
       input [touchscreen|touchpad|touchnavigation] swipe <x1> <y1> <x2> <y2> [d
uration(ms)]
       input trackball press
       input trackball roll <dx> <dy>

Can not use bash keywords (i am sure i am using the word wrongly here), without escaping.

C:\CODE\AdbPaste>adb shell input text "simple("
/system/bin/sh: syntax error: '(' unexpected

Can not send a huge string as the emulator timesout and drop much of it.

Common solution to use a SMS and copy/paste is faster on an actual device, but less practical for running automated tests in the emulator. On automated tests it is easier to wait a few seconds than to deal with application switching and copy paste.

Solution

Converts espaces to its keycode. Escape bash keywords. Break longer strings in smaller groups.

You can’t perform that action at this time.