Restrucuterde Autotype commands a bit

This commit is contained in:
michael starke
2014-02-11 20:58:27 +01:00
parent 0d66451e0c
commit 4f55d93451
11 changed files with 66 additions and 32 deletions

View File

@@ -7,11 +7,25 @@
//
#import "MPAutotypeKeyPress.h"
#import "MPKeyMapper.h"
@implementation MPAutotypeKeyPress
- (void)execute {
if(![self isValid]) {
return; // no valid command. Stop.
}
CGKeyCode mappedKey = [self _transformKeyCode];
[self sendPressKey:mappedKey modifierFlags:self.modifierMask];
}
- (BOOL)isValid {
return ([self _transformKeyCode] != kMPUnknownKeyCode);
}
- (CGKeyCode)_transformKeyCode {
NSString *key = [MPKeyMapper stringForKey:self.keyCode];
return [MPKeyMapper keyCodeForCharacter:key];
}
@end