Is there a way to differentiate between left and right Shift keys being pressed?

Solutions Collect From Internet About “Is there a way to differentiate between left and right Shift keys being pressed?”

You can do it like this:

-(void)flagsChanged:(NSEvent *)theEvent {

    if ([theEvent modifierFlags] == 131330) {
        NSLog(@"Left shift pressed!");
    }

    if ([theEvent modifierFlags] == 131332) {
        NSLog(@"Right shift pressed!");
    }
}