case 1:
if (keyInput.hasKeyCode) {
NJOutputKeyPress *k = [[NJOutputKeyPress alloc] init];
- k.vk = keyInput.keyCode;
+ k.keyCode = keyInput.keyCode;
return k;
} else {
return nil;
if ([output isKindOfClass:NJOutputKeyPress.class]) {
[radioButtons selectCellAtRow:1 column:0];
- keyInput.keyCode = [(NJOutputKeyPress*)output vk];
+ keyInput.keyCode = [(NJOutputKeyPress*)output keyCode];
} else if ([output isKindOfClass:NJOutputMapping.class]) {
[radioButtons selectCellAtRow:2 column:0];
NSMenuItem *item = [mappingPopup itemWithRepresentedObject:[(NJOutputMapping *)output mapping]];
}
- (NSDictionary *)serialize {
- return _vk != NJKeyInputFieldEmpty
- ? @{ @"type": self.class.serializationCode, @"key": @(_vk) }
+ return _keyCode != NJKeyInputFieldEmpty
+ ? @{ @"type": self.class.serializationCode, @"key": @(_keyCode) }
: nil;
}
+ (NJOutput *)outputDeserialize:(NSDictionary *)serialization
withMappings:(NSArray *)mappings {
NJOutputKeyPress *output = [[NJOutputKeyPress alloc] init];
- output.vk = [serialization[@"key"] intValue];
+ output.keyCode = [serialization[@"key"] intValue];
return output;
}
- (void)trigger {
- CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _vk, YES);
- CGEventPost(kCGHIDEventTap, keyDown);
- CFRelease(keyDown);
+ if (_keyCode != NJKeyInputFieldEmpty) {
+ CGEventRef keyDown = CGEventCreateKeyboardEvent(NULL, _keyCode, YES);
+ CGEventPost(kCGHIDEventTap, keyDown);
+ CFRelease(keyDown);
+ }
}
- (void)untrigger {
- CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _vk, NO);
- CGEventPost(kCGHIDEventTap, keyUp);
- CFRelease(keyUp);
+ if (_keyCode != NJKeyInputFieldEmpty) {
+ CGEventRef keyUp = CGEventCreateKeyboardEvent(NULL, _keyCode, NO);
+ CGEventPost(kCGHIDEventTap, keyUp);
+ CFRelease(keyUp);
+ }
}
@end
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>301</string>
+ <string>303</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>NSHumanReadableCopyright</key>