objective c - How to exit a loop when user presses Command + period on the keyboard -
my utility app performs text editing operations on app. after user sets parameters in nspanel , clicks ok, nspanel closes , while loop iterated performs necessary text editing in target app.
i offer user option halt operation using command + .. i'm not sure how check if user holding down keys while loop iterating.
the while loop simplified.
- (ibaction)filenametrimappend:(id)sender { [self activatetargetapp]; // applescript brings target app front [self openfilerenamedialog]; // applescript open file naming dialog // set variables use in loop user input [self close]; // close input nspanel while ([self filerenamedialogopen]) { // applescript returns false when editing done if (command +"." held down){ // need here return; } // text mod done here. // paste mod text target app field // move next field editing } }
assuming these 2 different processes, can use addglobalmonitorforeventsmatchingmask
observe keyboard.
see this link similar discussion.
Comments
Post a Comment