repeats / Repeat

Cross-platform mouse/keyboard record/replay and automation hotkeys/macros creation, and more advanced automation features.
Apache License 2.0
1.03k stars 76 forks source link

Feature request for speeding up playback #5

Closed OliverUv closed 7 years ago

OliverUv commented 7 years ago

I often have the following usage scenario:

For X items, go through the exact same mouse/keyboard movements. The items are often links to be clicked. There are few enough that I don't want to spend any time programming the link clicking, so I just want to record the common movements and re-trigger the recording a number of times.

I can do this with the current setup. What I can't do (quickly) is make the playback as fast as possible. It would be great with a mode that says something like "take all recorded actions, remove all blocking waits, but add a configurable (I'd go for 80ms) wait after each mouse click, to make sure web pages have time to refresh.

This would make the program a lot more useful, right now it just lets me drink coffee during the time I'd have spent doing the repetitive task. I want it to speed up the repetitive task itself.

OliverUv commented 7 years ago

Actually maybe the simplest way to fulfill my need is to add a way to say "speed up replay by 10x".

hptruong93 commented 7 years ago

A possible workaround for this is to write a task that can be activated with two inputs, one for registering the mouse locations, and the other to click on those location as fast as possible. Code will look like the following

// First declare points as an attribute in the class. Don't forget to import java.awt.Point;
// private ArrayList<Point> points = new ArrayList<>();

int key = invoker.get(0);

if (k == VK_C) { // Clear all registered points
   points.clear();
} else if (k == VK_A) { // Register this points
    // See https://github.com/repeats/Repeat/blob/master/src/core/controller/MouseCore.java#L24
    points.add(m.getPosition());
} else { // Click the points
    for (Point p : points) {
        m.leftClick(p.x, p.y);
        // Possible delay if need be
        c.delay(20);
    }
}

That said, sped up replay is certainly a good feature to have.

OliverUv commented 7 years ago

That looks like a pretty neat solution to this particular use-case. But the request still stands :))

hptruong93 commented 7 years ago

Implemented in 25fac2b86a0efbb08cc14a3634c5296ee186f296