Added {CLEARFIELD} to autotype commands. Stubbs for {DELAY X}

This commit is contained in:
michael starke
2014-08-20 12:46:02 +02:00
parent 04f519bd52
commit 9458c5f8a0
6 changed files with 114 additions and 3 deletions

View File

@@ -10,6 +10,8 @@
#import "MPAutotypePaste.h"
#import "MPAutotypeKeyPress.h"
#import "MPAutotypeClear.h"
#import "MPAutotypeDelay.h"
#import "MPAutotypeContext.h"
#import "MPKeyMapper.h"
@@ -163,19 +165,26 @@
}
+ (void)appendCommandForString:(NSString *)commandString toCommands:(NSMutableArray *)commands activeModifer:(CGEventFlags)flags {
if(!commandString) {
if(nil == commandString) {
return;
}
/* TODO: Test for special Commands */
/* TODO: fall back to paste if nothing matches */
NSString *delayPrefix = [[NSString alloc] initWithFormat:@"{%@", kKPKAutotypeDelay];
NSNumber *keyCodeNumber = [self keypressCommands][commandString];
if(keyCodeNumber) {
if(nil != keyCodeNumber) {
CGKeyCode keyCode = [keyCodeNumber keyCodeValue];
[commands addObject:[[MPAutotypeKeyPress alloc] initWithModifierMask:flags keyCode:keyCode]];
}
else if([kKPKAutotypeClearField isEqualToString:commandString]) {
[commands addObject:[[MPAutotypeClear alloc] init]];
}
else if([commandString hasPrefix:delayPrefix]){
[commands addObject:[[MPAutotypeDelay alloc] initWithDelay:5]];
/* TODO: find the delay */
}
else {
[self appendPasteCommandForContent:commandString toCommands:commands];
}