Closed shedali closed 5 years ago
Hello. Except by reading the file where the application saves the data, this is not possible.
@shedali I managed to get the stats out of Octomouse automatically by adding a timer that calls an external url every second. It's not pretty, but it works, i'm not a developer
Inside initWithStatusItem (in StatusItemView.m)
_timer = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(incStats:)
userInfo:nil
repeats:YES];
then at the bottom of StatusItemView.m ( before @ end )
-(void)incStats:(NSTimer*)timer {
InputEventsLogger* today = [[InputEventsController shared] todayLogger];
int todayKeyDown = [today keyDown];
int todayMouseDown = [today mouseDown];
int totalActivity = todayKeyDown + todayMouseDown;
NSString *url_str = [NSString stringWithFormat:@"http://example.com/webhook.php?do=update&totalstats=%i&keys=%i&clics=%i",totalActivity,todayKeyDown,todayMouseDown];
[self send_http_get_request:url_str];
//NSLog(@"%@",url_str);
}
- (void)send_http_get_request:(NSString *)url_str {
NSURL *url = [NSURL URLWithString:url_str];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
[NSURLConnection connectionWithRequest:request delegate:self];
}
This will ping your webhook.php url with today's stats. You can of course do it with any other data you want you'll just have to declare the variables for global and yesterday etc..
I hope this helps.
Hello. Except by reading the file where the application saves the data, this is not possible.
@KonsomeJona By that you mean the exported .csv file ? or is there a file somewhere that contains the stats at all time ?
Mehdi
@vlom31 There is, it's at ~/Library/Containers/com.takohi.octomouse/Data/Library/Preferences/com.takohi.octomouse.plist
in a binary format. Xcode can open it, if you want to look at the values.
It took a little digging, but the keycodes in there those are stored by keys 0-127 which appear to be mapped at https://github.com/KonsomeJona/OctoMouse/blob/c7ad4dc6e0327e900cad1275e1eb2187008f2830/OctoMouse/InputEventsController.m#L170 in the code.
That's as much as I know for now, and I only know it because I was looking into making a little heatmap parser from the data tonight, so I was already digging. :p
thanks for responses 👍
I would like to display keystroke information on a dashboard - is it possible to access this info outside the app?