xdotool, нажмите и удерживайте и переместите мышь

5189
Mustafa

Я хочу автоматизировать задачу, мне нужно прокрутить интерфейс карты, похожий на Google, что я обычно делаю:

  1. Нажмите на место
  2. Удерживайте нажатие
  3. Переместите мышь на 100 пикселей влево
  4. Хватит держать
  5. Подождите немного, вернитесь к 1

Тем не менее, я пытался, $ xdotool click 1 mousemove_relative 0 100но это не помогло, кажется, это не держит. Что я могу сделать, чтобы достичь этого?

3

2 ответа на вопрос

3
TuxForLife

Чистая версия xdotool

Допустим, ваше место 500 500

xdotool mousemove 500 500 xdotool keydown Pointer_Button1 xdotool mousemove_relative 0 100 xdotool keyup Pointer_Button1 sleep 1 

Вы также можете сжать его до одной строки, если хотите:

xdotool mousemove 500 500 keydown Pointer_Button1 mousemove_relative 0 100 keyup Pointer_Button1 sleep 1 
1
lemonsqueeze

You could use xnee to record your mouse action and replay it later when needed.

There's a gui for it called gnee. I didn't have very good results with it last time i tried but that was a long time ago, things might have changed since then.

Here's what i used for the recording:

$ sleep 2 ; xmessage ready ; sleep 1 ; cnee --record --mouse --keyboard -o cnee.data 

This lets you move around and prepare things before starting. Click ok when you're ready, wait 1s and do your action. Ctrl-c when you're done.

Then you can replay it with:

$cnee --replay -f cnee.data -v -e /dev/null -ns 

You can even replay it faster than the original (!)

$cnee --replay --speed-percent 40 -f cnee.data -v -e /dev/null -ns 

You'll probably have to edit out the end of cnee.data to get rid of what you did in between your action and the Ctrl-c.

Похожие вопросы