I'm using adb Shell input to emulating touchscreen interaction,
Working on Windows 8 with adb command line service.
For one long touch (not tap!) I'm using this command:
adb shell input swipe x1 y1 x1 y1 t
How can I emulate simultaneous 2 long taps from command line?
Thanks!
I've searched a bit and seems that the easiest way is not to find the proper commands (you've to emulate a real set of N events moving the 2 fingers around the screen to pinch), but you can instead try this: save a gesture (with X fingers) and then play it back from adb.
For details see this question, already well replied in the Saurabh Meshram answer:
Fire a pinch in/out command to Android phone using adb
EDIT:
you can try to understand what the events means (quite obscure at first glimpse), see:
http://ktnr74.blogspot.pt/2013/06/emulating-touchscreen-interaction-with.html
try to use:
adb shell "input swipe x1 y1 x1 y1 t && input swipe x2 y2 x2 y2 t"
Related
Does anyone knows a visual debugger that can be used with google colab. I tried PixieDebugger, however, its not working for me, I can install it and import it but when I use it in Colab(%%pixie_debugger) it doesn't show anything.
How visual do you want - have you tried the %debug magic?
Enter this into a cell and run it.
%debug
x = 1
y = 2
z = x * y
print(z)
You should see a prompt like this
ipdb>
It's a debugger so there are commands to examine variables and move forward and so on.
Type r to exit.
I am using paramiko for ssh interactive commands. I am able to successfully send all the required commands. I am stuck on one issue. i need somebody help to automate this task.
Issue is on output, i will get 4 options, from this options, i need to move to the required option by using arrow keys and then press enter button to select that option.
Please let me know if anybody knows about this.
import paramiko
import time
import os
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('server',port=22,username='user',password='pass123')
print("connected to the linux machine from windows machine.")
channel=ssh.invoke_shell()
channel_data = str()
while True:
if channel.recv_ready():
channel_data += channel.recv(9999).decode(encoding='utf_8', errors='strict')
os.system('cls')
print("##### Device Output #####")
print("\n",channel_data)
print("\n #####################")
else:
continue
time.sleep(5)
if channel_data.endswith('[root#home ~]# '):
channel.send('somecommand\n')
#highlight and then press enter button to select that option. please help for below code
ifelse channel_data.endswith('I am trying to choose this option from the list'):
channel.send('\n')
We need to send the keycode. for down arrow key, "[B 1b 5b 42" is key code.
Below is the link for complete list of keycode mapping.
http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlkeycodes.html
I built a OS X command line tool in Swift (same problem in Objective-C) for downloading certain files. I am trying to update the command line with download progress. Unfortunately, I cannot prevent the print statement to jump to the next line.
According to my research, the carriage return \r should jump to the beginning of the same line (while \n would insert a new line).
All tests have been performed in the OS X Terminal app, not the Xcode console.
let logString = String(format: "%2i%% %.2fM \r", percentage, megaBytes)
print(logString)
Still, the display inserts a new line. How to prevent this?
Note: This won't work in Xcode's debugger window because it's not a real terminal emulator and doesn't fully support escape sequences. So, to test things, you have to compile it and then manually run it in a Terminal window.
\r should work to move to the beginning of the current line in most terminals, but you should also take a look at VT100 Terminal Control Escape Sequences. They work by sending an escape character, \u{1B} in Swift, and then a command. (Warning: they make some pretty ugly string definitions)
One that you'll probably need is \u{1B}[K which clears the line from the current cursor position to the end. If you don't do this and your progress output varies in length at all, you'll get artifacts left over from previous print statements.
Some other useful ones are:
Move to any (x, y) position: \u{1B}[\(y);\(x)H Note: x and y are Ints inserted with string interpolation.
Save cursor state and position: \u{1B}7
Restore cursor state and position: \u{1B}8
Clear screen: \u{1B}[2J
You can also do interesting things like set text foreground and background colors.
If for some reason you can't get \r to work, you could work around it by saving the cursor state/position just before you print your logString and then restoring it after:
let logString = String(format: "\u{1B}7%2i%% %.2fM \u{1B}8", percentage, megaBytes)
print(logString)
Or by moving to a pre-defined (x, y) position, before printing it:
let x = 0
let y = 1 // Rows typically start at 1 not 0, but it depends on the terminal and shell
let logString = String(format: "\u{1B}[\(y);\(x)H%2i%% %.2fM ", percentage, megaBytes)
print(logString)
Here's an example assuming some async task is taking place with callbacks that pass a Progress type.
// Print an empty string first otherwise whichever line is above the printed out progress will be removed
print("")
let someProgressCallback: ExampleAsyncCallbackType = { progress in
let percentage = Int(progress.fractionCompleted * 100)
print("\u{1B}[1A\u{1B}[KDownloaded: \(percentage)%")
}
The key part is \u{1B}[1A\u{1B}[K and then whatever you want to print out to the screen following.
Your example will only work on the actual command line, not in the debugger console. And you also need to flush stdout for every iteration, like this:
var logString = String(format: "%2i%% %.2fM \r", 10, 5)
print(logString)
fflush(__stdoutp)
xdotool doesn't seem to work with my new macbook retina with mountain lion installed. It launchs XQuartz but does't seem to simulate mouse click or keyboard inputs like before. I don't know if it's related to mountain lion or to the retina display. A tool like cliclick (http://www.bluem.net/en/mac/cliclick/) seems to work though and does the job. Nevertheless, I prefer a tool that work both on mac and on linux. Does anyone experience the same issue?
Using:
OS X 10.8.1
MacBook Pro Retina
xdotool 2.20110530.1 from macports
XQuartz 2.7.3
I've found this one for Mac OS X which does the same job as xdotool:
Website Url: http://www.bluem.net/en/mac/cliclick/
It works with Retina Display and Mountain Lion. It's pretty simple to use. Here the manual :
cliclick ("Command Line Interface Click") is a tool for executing mouse- and keyboard-related actions from the shell/Terminal
USAGE
cliclick [-m <mode>] [-r] command1 [command2] [...]
OPTIONS
-r Restore initial mouse location when finished
-m <mode> The mode can be either “verbose” (cliclick will print a
description of each action to stdout just before it is
performed) or “test” (cliclick will only print the
description, but not perform the action)
COMMANDS
To use cliclick, you pass an arbitrary number of commands as arguments. A command consists of a command identifier (a string that tells cliclick what kind of action to perform) and usually one or more arguments to the command, which are separated from the command identifier by a colon. Example: “c:123,456” is the command for clicking (the “c” is the command identifier for clicking) at the position with x coordinate 123 and y coordinate 456. See below for a list of all commands and the arguments they expect.
LIST OF COMMANDS
m:x,y MOVE the mouse to the point with the given coordinates.
Example: “m:12,34” will move the mouse to the point with
x coordinate 12 and y coordinate 34.
c:x,y Will CLICK at the point with the given coordinates.
Example: “c:12,34” will click at the point with x coordinate
12 and y coordinate 34. Instead of x and y values, you may
also use “.”, which means: the current position.
dc:x,y Will DOUBLE-CLICK at the point with the given coordinates.
Example: “dc:12,34” will double-click at the point with x
coordinate 12 and y coordinate 34. Instead of x and y values,
you may also use “.”, which means: the current position.
tc:x,y Will TRIPLE-CLICK at the point with the given coordinates.
Example: “tc:12,34” will triple-click at the point with x
coordinate 12 and y coordinate 34. Instead of x and y values,
you may also use “.”, which means: the current position.
kd:keys Will trigger a KEY DOWN event for a comma-separated list of
modifier keys (“cmd”, “alt” or “ctrl”).
Example: “kd:cmd,alt” will press the command key and the
option key (and will keep them down until you release them
with another command)
ku:keys Will trigger a KEY UP event for a comma-separated list of
modifier keys (“cmd”, “alt” or “ctrl”).
Example: “ku:cmd,ctrl” will release the command key and the
control key (which will only have an effect if you performed
a “key down” before)
p[:str] Will PRINT the given string. If the string is “.”, the
current MOUSE POSITION is printed. As a convenience, you can skip
the string completely and just write “p” to get the current position.
Example: “p:.” or “p” will print the current mouse position
Example: “p:'Hello world'” will print “Hello world”
w:ms Will wait/pause for the given number of milliseconds.
Example: “w:500” will pause command execution for half a second
Version 2.0, released 08/17/2012
Author: Carsten Blüm, <macapps#bluem.net>
Website: www.bluem.net/jump/cliclick/
I have just started using the hardstatus capability of GNU screen to get a status bar of at the bottom of my terminal. This is particularly useful when running nested screen processes as I get nested status bars which makes it clear how many times I have to press the command key to access a particular screen instance.
For example
tom#stilton:~% ls
a/ b/ c/ d
.
.
.
[stilton] [1* zsh 2$ mutt]
[cheddar] [1$ emacs 2* ssh]
* indicates which window is selected. This makes it clear that I am running screen on cheddar with two windows: emacs and ssh. In the latter I am running another screen session on stilton with two windows: zsh and mutt. To switch to mutt on stilton I need to do "C-a a 2".
This is very useful, but could be more useful.
My question: when the command key is pressed, can I indicate this in the status bar, for example by highlighting it?
This would mean that when "C-a" is pressed the [cheddar] status bar would be highlighted and I would know that commands would be sent to that screen instance. If I were to further press "a" to send a literal "C-a" to the nested screen process the [cheddar] status bar would lose its highlight and the [stilton] status bar would highlight.
This would decrease the cognitive load of using screen considerably!
In git version, that feature was committed recently.
http://git.savannah.gnu.org/cgit/screen.git/commit/?id=db59704c1297c056cec0cc9305ae92e44a15bf33
This new string escape character %E can be used in the same manner as %F both caption and hardstatus.
In the following examples, when you press C-a, then foreground color of hostname %H changes to yellow
hardstatus alwayslastline '%m/%d %02c:%s %?%E%{= .Y}%:%{= .g}%?%H%{-} %L=%-w%45L>%{= g.}%n %t%{-}%+w %-17<%=%{= .y}(%l)'