-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (30 loc) · 1.09 KB
/
main.cpp
File metadata and controls
39 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <Utils.h>
#include <iostream>
#include <ActionRecorder.h>
// Comment out to test on MacOS
#include <EventHookWindows.h>
// Uncomment to test on MacOS
// #include <EventHookMacOS.h>
int main() {
int recordFor = 10;
Robot::ActionRecorder recorder;
Robot::EventHook hook(recorder);
std::cout << "Start recording actions in 3 seconds..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
// Start recording
std::cout << "Starting to record actions for " << recordFor << " seconds..." << std::endl;
std::thread recordingThread([&hook] { hook.StartRecording(); });
// Sleep for 10 seconds
std::this_thread::sleep_for(std::chrono::seconds(recordFor));
// Stop recording
std::cout << "Stopping recording..." << std::endl;
hook.StopRecording();
recordingThread.join();
// Wait for 5 seconds before replaying
std::cout << "Replaying actions in 3 seconds..." << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(3));
// Replay the recorded actions
std::cout << "Replaying actions..." << std::endl;
recorder.ReplayActions();
return 0;
}